diff options
author | 2019-03-03 18:39:10 +0000 | |
---|---|---|
committer | 2019-03-03 18:39:10 +0000 | |
commit | b6c30fbbf428daf85b015d43c7bca87414fded9a (patch) | |
tree | 9c83239f0ef2cf5f2e16d3ee8c0f33141eb3ee9f | |
parent | uppercase Internet, to match the other instance in this page; (diff) | |
download | wireguard-openbsd-b6c30fbbf428daf85b015d43c7bca87414fded9a.tar.xz wireguard-openbsd-b6c30fbbf428daf85b015d43c7bca87414fded9a.zip |
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@
-rw-r--r-- | lib/librthread/rthread_rwlock.c | 4 |
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); } |