about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/pthread/pthread_rwlock_wrlock.c')
-rw-r--r--nptl/sysdeps/pthread/pthread_rwlock_wrlock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c b/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
index 024b6711a9..03c37a1933 100644
--- a/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
+++ b/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
@@ -63,18 +63,19 @@ __pthread_rwlock_wrlock (rwlock)
 	  break;
 	}
 
+      int waitval = rwlock->__data.__writer_wakeup;
+
       /* Free the lock.  */
       lll_mutex_unlock (rwlock->__data.__lock);
 
       /* Wait for the writer or reader(s) to finish.  */
-      lll_futex_wait (&rwlock->__data.__writer_wakeup, 0);
+      lll_futex_wait (&rwlock->__data.__writer_wakeup, waitval);
 
       /* Get the lock.  */
       lll_mutex_lock (rwlock->__data.__lock);
 
       /* To start over again, remove the thread from the writer list.  */
       --rwlock->__data.__nr_writers_queued;
-      rwlock->__data.__writer_wakeup = 0;
     }
 
   /* We are done, free the lock.  */