This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/23861] rdlock stalls indefinitely on an unlocked pthread rwlock


https://sourceware.org/bugzilla/show_bug.cgi?id=23861

--- Comment #2 from richard prohaska <prohaska7 at gmail dot com> ---
This patch sets r = __readers in the inner loop as suggested and runs the test
program successfully.

diff --git a/nptl/pthread_rwlock_common.c b/nptl/pthread_rwlock_common.c
index a290d08332..8c970d19c3 100644
--- a/nptl/pthread_rwlock_common.c
+++ b/nptl/pthread_rwlock_common.c
@@ -314,7 +314,7 @@ __pthread_rwlock_rdlock_full (pthread_rwlock_t *rwlock,
                 harmless because the flag is just about the state of
                 __readers, and all threads set the flag under the same
                 conditions.  */
-             while ((atomic_load_relaxed (&rwlock->__data.__readers)
+                while (((r = atomic_load_relaxed (&rwlock->__data.__readers))
                  & PTHREAD_RWLOCK_RWAITING) != 0)
                {
                  int private = __pthread_rwlock_get_private (rwlock);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]