mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 14:30:06 +00:00
pthread_cond_broadcast: Fix waiters-after-spinning case [BZ #23538]
This commit is contained in:
parent
4061791fcc
commit
99ea93ca31
@ -1,3 +1,11 @@
|
||||
2018-08-27 Martin Kuchta <martin.kuchta@netapp.com>
|
||||
Torvald Riegel <triegel@redhat.com>
|
||||
|
||||
[BZ #23538]
|
||||
* nptl/pthread_cond_common.c (__condvar_quiesce_and_switch_g1):
|
||||
Update r to include the set wake-request flag if waiters are
|
||||
remaining after spinning.
|
||||
|
||||
2018-08-27 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* sysdeps/gnu/netinet/udp.h (UDP_SEGMENT): New macro.
|
||||
|
@ -405,8 +405,12 @@ __condvar_quiesce_and_switch_g1 (pthread_cond_t *cond, uint64_t wseq,
|
||||
{
|
||||
/* There is still a waiter after spinning. Set the wake-request
|
||||
flag and block. Relaxed MO is fine because this is just about
|
||||
this futex word. */
|
||||
r = atomic_fetch_or_relaxed (cond->__data.__g_refs + g1, 1);
|
||||
this futex word.
|
||||
|
||||
Update r to include the set wake-request flag so that the upcoming
|
||||
futex_wait only blocks if the flag is still set (otherwise, we'd
|
||||
violate the basic client-side futex protocol). */
|
||||
r = atomic_fetch_or_relaxed (cond->__data.__g_refs + g1, 1) | 1;
|
||||
|
||||
if ((r >> 1) > 0)
|
||||
futex_wait_simple (cond->__data.__g_refs + g1, r, private);
|
||||
|
Loading…
Reference in New Issue
Block a user