public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] nptl: Fix pthread_cancel cancelhandling atomic operations Date: Wed, 20 Apr 2022 15:06:48 +0000 (GMT) [thread overview] Message-ID: <20220420150648.24BC33857C4A@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=62be9681677e7ce820db721c126909979382d379 commit 62be9681677e7ce820db721c126909979382d379 Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Wed Apr 20 12:01:43 2022 -0300 nptl: Fix pthread_cancel cancelhandling atomic operations The 404656009b reversion did not setup the atomic loop to set the cancel bits correctly. The fix is essentially what pthread_cancel did prior 26cfbb7162ad. Checked on x86_64-linux-gnu and aarch64-linux-gnu. Diff: --- nptl/pthread_cancel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c index c76882e279..e67b2df5cc 100644 --- a/nptl/pthread_cancel.c +++ b/nptl/pthread_cancel.c @@ -121,6 +121,7 @@ __pthread_cancel (pthread_t th) int newval; do { + again: newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK; if (oldval == newval) break; @@ -134,7 +135,7 @@ __pthread_cancel (pthread_t th) int newval2 = oldval | CANCELING_BITMASK; if (!atomic_compare_exchange_weak_acquire (&pd->cancelhandling, &oldval, newval2)) - continue; + goto again; if (pd == THREAD_SELF) /* This is not merely an optimization: An application may
reply other threads:[~2022-04-20 15:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220420150648.24BC33857C4A@sourceware.org \ --to=azanella@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).