summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjpierre%netscape.com <devnull@localhost>2002-08-30 22:46:45 +0000
committerjpierre%netscape.com <devnull@localhost>2002-08-30 22:46:45 +0000
commitac22502a2f258a6abf263777ab9b91ad35130d22 (patch)
tree4a3ffbca13f7d1283be34df71eeba0dba9bfa460
parent86384dcfb436080469af5362cdb7e80b8496ba20 (diff)
downloadnss-hg-ac22502a2f258a6abf263777ab9b91ad35130d22.tar.gz
Fix for 165639 - NSSRWLock_UnlockWrite causes deadlock when using recursivity of locoks. Fix by Wan-Teh
-rw-r--r--security/nss/lib/util/nssrwlk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/security/nss/lib/util/nssrwlk.c b/security/nss/lib/util/nssrwlk.c
index 6913b4165..cc548bd1c 100644
--- a/security/nss/lib/util/nssrwlk.c
+++ b/security/nss/lib/util/nssrwlk.c
@@ -337,7 +337,12 @@ NSSRWLock_UnlockWrite(NSSRWLock *rwlock)
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);
+ }
}
PZ_Unlock(rwlock->rw_lock);