public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/release/2.34/master] pthread/tst-cancel28: Fix barrier re-init race condition Date: Tue, 14 Dec 2021 04:38:04 +0000 (GMT) [thread overview] Message-ID: <20211214043804.4C00B3858C60@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=06865865151579d1aa17d38110060a68b85c5d90 commit 06865865151579d1aa17d38110060a68b85c5d90 Author: Stafford Horne <shorne@gmail.com> Date: Sat Sep 25 17:02:06 2021 +0900 pthread/tst-cancel28: Fix barrier re-init race condition When running this test on the OpenRISC port I am working on this test fails with a timeout. The test passes when being straced or debugged. Looking at the code there seems to be a race condition in that: 1 main thread: calls xpthread_cancel 2 sub thread : receives cancel signal 3 sub thread : cleanup routine waits on barrier 4 main thread: re-inits barrier 5 main thread: waits on barrier After getting to 5 the main thread and sub thread wait forever as the 2 barriers are no longer the same. Removing the barrier re-init seems to fix this issue. Also, the barrier does not need to be reinitialized as that is done by default. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit 9874ca536b1d0662b1cea46af3ce09a4d42aeb32) Diff: --- sysdeps/pthread/tst-cancel28.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sysdeps/pthread/tst-cancel28.c b/sysdeps/pthread/tst-cancel28.c index 627cbc8160..9286c159b3 100644 --- a/sysdeps/pthread/tst-cancel28.c +++ b/sysdeps/pthread/tst-cancel28.c @@ -69,7 +69,6 @@ do_test (void) xpthread_cancel (timer_thread); - xpthread_barrier_init (&barrier, NULL, 2); xpthread_barrier_wait (&barrier); return 0;
reply other threads:[~2021-12-14 4:38 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=20211214043804.4C00B3858C60@sourceware.org \ --to=siddhesh@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).