diff options
author | wtc%netscape.com <devnull@localhost> | 2002-08-30 23:55:51 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2002-08-30 23:55:51 +0000 |
commit | 72ea39c144d53e64a2d5b187e68a868d6be19439 (patch) | |
tree | 0d310325f27122398ae4047ce63ca0b4747822a6 | |
parent | cbcb6755d440dca892bb3e27d786a85c6405d750 (diff) | |
download | nss-hg-72ea39c144d53e64a2d5b187e68a868d6be19439.tar.gz |
Checked in an equivalent but simpler fix for Bug 165639
(NSSRWLock_UnlockWrite failed to wake up waiting readers).
-rw-r--r-- | security/nss/lib/util/nssrwlk.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/security/nss/lib/util/nssrwlk.c b/security/nss/lib/util/nssrwlk.c index cc548bd1c..33aaaa713 100644 --- a/security/nss/lib/util/nssrwlk.c +++ b/security/nss/lib/util/nssrwlk.c @@ -331,18 +331,13 @@ NSSRWLock_UnlockWrite(NSSRWLock *rwlock) rwlock->rw_owner = NULL; /* I don't own it any more. */ - if (rwlock->rw_reader_locks == 0) { /* no readers, wake up somebody. */ - /* Give preference to waiting writers. */ - if (rwlock->rw_waiting_writers > 0) + /* Give preference to waiting writers. */ + if (rwlock->rw_waiting_writers > 0) { + if (rwlock->rw_reader_locks == 0) PZ_NotifyCondVar(rwlock->rw_writer_waitq); - else if (rwlock->rw_waiting_readers > 0) - PZ_NotifyAllCondVar(rwlock->rw_reader_waitq); - } else { - /* Give preference to waiting writers. */ - if ( rwlock->rw_waiting_writers == 0 && - rwlock->rw_waiting_readers > 0) - PZ_NotifyAllCondVar(rwlock->rw_reader_waitq); - } + } else if (rwlock->rw_waiting_readers > 0) { + PZ_NotifyAllCondVar(rwlock->rw_reader_waitq); + } } PZ_Unlock(rwlock->rw_lock); |