From 5d4eb88954fa2402dcce06ccecde800da1c8703f Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 21 Oct 2004 08:19:50 +0000 Subject: Mutex logic fix --- pthread_mutex_unlock.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pthread_mutex_unlock.c') diff --git a/pthread_mutex_unlock.c b/pthread_mutex_unlock.c index e28b38a..9b8e504 100644 --- a/pthread_mutex_unlock.c +++ b/pthread_mutex_unlock.c @@ -67,8 +67,13 @@ pthread_mutex_unlock (pthread_mutex_t * mutex) { if (idx < 0) { - /* Someone may be waiting on that mutex */ - if (SetEvent (mx->event) == 0) + /* + * Someone may be waiting on that mutex. + * Pulse event on an auto-reset event will + * release one waiter if possible, otherwise + * it will just reset the event. + */ + if (PulseEvent (mx->event) == 0) { result = EINVAL; } -- cgit v1.2.3