summaryrefslogtreecommitdiff
path: root/pthread_mutex_unlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'pthread_mutex_unlock.c')
-rw-r--r--pthread_mutex_unlock.c9
1 files changed, 7 insertions, 2 deletions
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;
}