From: Simon Ruderich Date: Sun, 28 Jul 2013 12:21:20 +0000 (+0200) Subject: sem.c: Fix P() for negative start values. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=9f3f278ae8e7d4b2daa5ca8d331bca70bb550c76;p=tlsproxy%2Ftlsproxy.git sem.c: Fix P() for negative start values. --- diff --git a/src/sem.c b/src/sem.c index 0df93c6..ee03e0b 100644 --- a/src/sem.c +++ b/src/sem.c @@ -69,7 +69,7 @@ int sem_del(SEM *sem) { void P(SEM *sem) { pthread_mutex_lock(&sem->mutex); - while (sem->value == 0) { + while (sem->value <= 0) { pthread_cond_wait(&sem->condition, &sem->mutex); } sem->value--;