From 9f3f278ae8e7d4b2daa5ca8d331bca70bb550c76 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 28 Jul 2013 14:21:20 +0200 Subject: [PATCH] sem.c: Fix P() for negative start values. --- src/sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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--; -- 2.45.2