about summary refs log tree commit diff
path: root/src/thread/pthread_rwlock_timedrdlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/pthread_rwlock_timedrdlock.c')
-rw-r--r--src/thread/pthread_rwlock_timedrdlock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/thread/pthread_rwlock_timedrdlock.c b/src/thread/pthread_rwlock_timedrdlock.c
index 884b7a1e..ea50da4a 100644
--- a/src/thread/pthread_rwlock_timedrdlock.c
+++ b/src/thread/pthread_rwlock_timedrdlock.c
@@ -8,7 +8,7 @@ int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rw, const struct times
 	if (r != EBUSY) return r;
 	
 	int spins = 100;
-	while (spins-- && rw->_rw_lock) a_spin();
+	while (spins-- && rw->_rw_lock && !rw->_rw_waiters) a_spin();
 
 	while ((r=pthread_rwlock_tryrdlock(rw))==EBUSY) {
 		if (!(r=rw->_rw_lock) || (r&0x7fffffff)!=0x7fffffff) continue;