diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-03-14 01:02:47 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-03-14 01:02:47 +0000 |
commit | 496ff1af4580cae19e94bc6d1c5a26b0ff888747 (patch) | |
tree | 47f8b41c69be1997134dabdf844b4a2503655a08 /lib | |
parent | 4f171e58698cb3372b617c77e6795e9cd4981546 (diff) | |
download | FreeBSD-src-496ff1af4580cae19e94bc6d1c5a26b0ff888747.zip FreeBSD-src-496ff1af4580cae19e94bc6d1c5a26b0ff888747.tar.gz |
Fix a bug in rwlock. When a rwlock was locked by reader threads, a
writter thread can block reader threads to get read lock.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkse/thread/thr_rwlock.c | 2 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_rwlock.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/libkse/thread/thr_rwlock.c b/lib/libkse/thread/thr_rwlock.c index f41e8a2..ce9eb8a 100644 --- a/lib/libkse/thread/thr_rwlock.c +++ b/lib/libkse/thread/thr_rwlock.c @@ -157,7 +157,7 @@ _pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) return(ret); /* give writers priority over readers */ - while (prwlock->blocked_writers || prwlock->state < 0) { + while (prwlock->state < 0) { ret = pthread_cond_wait(&prwlock->read_signal, &prwlock->lock); if (ret != 0) { diff --git a/lib/libpthread/thread/thr_rwlock.c b/lib/libpthread/thread/thr_rwlock.c index f41e8a2..ce9eb8a 100644 --- a/lib/libpthread/thread/thr_rwlock.c +++ b/lib/libpthread/thread/thr_rwlock.c @@ -157,7 +157,7 @@ _pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) return(ret); /* give writers priority over readers */ - while (prwlock->blocked_writers || prwlock->state < 0) { + while (prwlock->state < 0) { ret = pthread_cond_wait(&prwlock->read_signal, &prwlock->lock); if (ret != 0) { |