From 46ab1b612d1d3dc956e14ff76f4e9066706a4cdc Mon Sep 17 00:00:00 2001 From: Visa Hankala Date: Sun, 3 Mar 2019 18:39:11 +0000 Subject: 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@ --- lib/librthread/rthread_rwlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/librthread') 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 * Copyright (c) 2012 Philip Guenther @@ -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); } -- cgit v1.2.3