summaryrefslogtreecommitdiff
path: root/src/thread/pthread_rwlock_timedwrlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/pthread_rwlock_timedwrlock.c')
-rw-r--r--src/thread/pthread_rwlock_timedwrlock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/thread/pthread_rwlock_timedwrlock.c b/src/thread/pthread_rwlock_timedwrlock.c
index f02b174b..8d04f561 100644
--- a/src/thread/pthread_rwlock_timedwrlock.c
+++ b/src/thread/pthread_rwlock_timedwrlock.c
@@ -8,7 +8,7 @@ int pthread_rwlock_timedwrlock(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_trywrlock(rw))==EBUSY) {
if (!(r=rw->_rw_lock)) continue;