]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/commitdiff
sem.c: Fix P() for negative start values.
authorSimon Ruderich <simon@ruderich.org>
Sun, 28 Jul 2013 12:21:20 +0000 (14:21 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 28 Jul 2013 12:21:20 +0000 (14:21 +0200)
src/sem.c

index 0df93c62078ec73295c031d140eb824b4430acbc..ee03e0b1d0872392d3770851e5bcdd372d49750e 100644 (file)
--- 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--;