summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_umtx.h
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2009-09-25 22:45:59 +0000
committerdes <des@FreeBSD.org>2009-09-25 22:45:59 +0000
commitbf5117185e83a178d672946c3f7053d0ef92be27 (patch)
tree394fcfe01b613c0b5b5edbfc414a17c73481ad5d /lib/libthr/thread/thr_umtx.h
parentb79ff8160af6fa640e29ce784e59acd49cd1e7fc (diff)
parent5c2742e3dae3ef549329b770ec44b16ca930dc1f (diff)
downloadFreeBSD-src-bf5117185e83a178d672946c3f7053d0ef92be27.zip
FreeBSD-src-bf5117185e83a178d672946c3f7053d0ef92be27.tar.gz
Sync with head
Diffstat (limited to 'lib/libthr/thread/thr_umtx.h')
-rw-r--r--lib/libthr/thread/thr_umtx.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_umtx.h b/lib/libthr/thread/thr_umtx.h
index 41b5f96..a6e462e 100644
--- a/lib/libthr/thread/thr_umtx.h
+++ b/lib/libthr/thread/thr_umtx.h
@@ -171,8 +171,11 @@ _thr_rwlock_unlock(struct urwlock *rwlock)
for (;;) {
if (__predict_false(URWLOCK_READER_COUNT(state) == 0))
return (EPERM);
- if (!((state & URWLOCK_WRITE_WAITERS) && URWLOCK_READER_COUNT(state) == 1)) {
- if (atomic_cmpset_rel_32(&rwlock->rw_state, state, state-1))
+ if (!((state & (URWLOCK_WRITE_WAITERS |
+ URWLOCK_READ_WAITERS)) &&
+ URWLOCK_READER_COUNT(state) == 1)) {
+ if (atomic_cmpset_rel_32(&rwlock->rw_state,
+ state, state-1))
return (0);
state = rwlock->rw_state;
} else {
OpenPOWER on IntegriCloud