summaryrefslogtreecommitdiff
path: root/lib/librthread
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2019-03-03 18:39:11 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2019-03-03 18:39:11 +0000
commit46ab1b612d1d3dc956e14ff76f4e9066706a4cdc (patch)
tree98c85a286be1298a9ce199559fff0413c5d6ff5c /lib/librthread
parentd3fbe4c8a723b4aa1f80a657c4c8bc13da436b7c (diff)
Wake all waiters when unlocking an rwlock. This fixes a hang
that could happen if there was more than one writer waiting for a read-locked rwlock. Problem found by semarie@. OK semarie@ tedu@
Diffstat (limited to 'lib/librthread')
-rw-r--r--lib/librthread/rthread_rwlock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/librthread/rthread_rwlock.c b/lib/librthread/rthread_rwlock.c
index b82a3672266..62254801476 100644
--- a/lib/librthread/rthread_rwlock.c
+++ b/lib/librthread/rthread_rwlock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_rwlock.c,v 1.12 2019/02/13 13:22:14 mpi Exp $ */
+/* $OpenBSD: rthread_rwlock.c,v 1.13 2019/03/03 18:39:10 visa Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
* Copyright (c) 2012 Philip Guenther <guenther@openbsd.org>
@@ -273,7 +273,7 @@ pthread_rwlock_unlock(pthread_rwlock_t *rwlockp)
} while (atomic_cas_uint(&rwlock->value, val, new) != val);
if (new == UNLOCKED && (val & WAITING))
- _wake(&rwlock->value, COUNT(val));
+ _wake(&rwlock->value, INT_MAX);
return (0);
}