summaryrefslogtreecommitdiff
path: root/hurd/mutex.h
diff options
context:
space:
mode:
Diffstat (limited to 'hurd/mutex.h')
-rw-r--r--hurd/mutex.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/hurd/mutex.h b/hurd/mutex.h
index 3e21eee..3f50934 100644
--- a/hurd/mutex.h
+++ b/hurd/mutex.h
@@ -89,8 +89,9 @@ ss_mutex_unlock (__const char *caller, int line, ss_mutex_t *lockp)
{
/* We rely on the knowledge that unlocked is 0, locked and no
waiters is 1 and locked with waiters is 2. Thus if *lockp is 1,
- an atomic dec yields 0 and we know that there are no waiters. */
- if (! atomic_decrement_and_test (lockp))
+ an atomic dec yields 1 (the old value) and we know that there are
+ no waiters. */
+ if (atomic_decrement_and_test (lockp) != _MUTEX_LOCKED)
/* There are waiters. */
{
*lockp = 0;