public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: John Baldwin <jhb@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb.threads/execl.c: Ensure all threads are started before execl. Date: Tue, 7 Mar 2023 00:58:44 +0000 (GMT) [thread overview] Message-ID: <20230307005845.14E363858C66@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5c1e53c99cf08b55fda078902a7363823e8638cb commit 5c1e53c99cf08b55fda078902a7363823e8638cb Author: John Baldwin <jhb@FreeBSD.org> Date: Mon Mar 6 16:55:22 2023 -0800 gdb.threads/execl.c: Ensure all threads are started before execl. Use a pthread_barrier to ensure all threads are started before proceeding to the breakpoint where info threads output is checked. Diff: --- gdb/testsuite/gdb.threads/execl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/testsuite/gdb.threads/execl.c b/gdb/testsuite/gdb.threads/execl.c index 8fb42e7e9ed..b9b42a29247 100644 --- a/gdb/testsuite/gdb.threads/execl.c +++ b/gdb/testsuite/gdb.threads/execl.c @@ -26,9 +26,13 @@ #include <string.h> #include <stdlib.h> +static pthread_barrier_t threads_started_barrier; + void * thread_function (void *arg) { + pthread_barrier_wait (&threads_started_barrier); + while (1) sleep (100); return NULL; @@ -41,9 +45,13 @@ main (int argc, char* argv[]) pthread_t thread2; char *new_image; + pthread_barrier_init (&threads_started_barrier, NULL, 3); + pthread_create (&thread1, NULL, thread_function, NULL); pthread_create (&thread2, NULL, thread_function, NULL); + pthread_barrier_wait (&threads_started_barrier); + new_image = malloc (strlen (argv[0]) + 2); strcpy (new_image, argv[0]); strcat (new_image, "1");
reply other threads:[~2023-03-07 0:58 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=20230307005845.14E363858C66@sourceware.org \ --to=jhb@sourceware.org \ --cc=gdb-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).