mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 13:00:06 +00:00
nptl: Fix pthread_cancel cancelhandling atomic operations
The404656009b
reversion did not setup the atomic loop to set the cancel bits correctly. The fix is essentially what pthread_cancel did prior26cfbb7162
. Checked on x86_64-linux-gnu and aarch64-linux-gnu. (cherry picked from commit62be968167
)
This commit is contained in:
parent
8e8d46d598
commit
68d3a9a696
@ -121,6 +121,7 @@ __pthread_cancel (pthread_t th)
|
|||||||
int newval;
|
int newval;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
again:
|
||||||
newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
|
newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
|
||||||
if (oldval == newval)
|
if (oldval == newval)
|
||||||
break;
|
break;
|
||||||
@ -134,7 +135,7 @@ __pthread_cancel (pthread_t th)
|
|||||||
int newval2 = oldval | CANCELING_BITMASK;
|
int newval2 = oldval | CANCELING_BITMASK;
|
||||||
if (!atomic_compare_exchange_weak_acquire (&pd->cancelhandling,
|
if (!atomic_compare_exchange_weak_acquire (&pd->cancelhandling,
|
||||||
&oldval, newval2))
|
&oldval, newval2))
|
||||||
continue;
|
goto again;
|
||||||
|
|
||||||
if (pd == THREAD_SELF)
|
if (pd == THREAD_SELF)
|
||||||
/* This is not merely an optimization: An application may
|
/* This is not merely an optimization: An application may
|
||||||
|
Loading…
Reference in New Issue
Block a user