Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: simon.marchi@polymtl.ca
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/testsuite: fix race condition in gdb.replay/missing-thread.c
Date: Fri, 20 Feb 2026 12:05:54 -0700	[thread overview]
Message-ID: <87cy1z1bhp.fsf@tromey.com> (raw)
In-Reply-To: <20260206175807.631814-1-simon.marchi@polymtl.ca> (simon marchi's message of "Fri, 6 Feb 2026 12:57:56 -0500")

>>>>> "Simon" == simon marchi <simon.marchi@polymtl.ca> writes:

Simon> Fix it by introducing a separate boolean predicate protected by the
Simon> shared mutex, and looping until it is true.  This is the way
Simon> pthread_cond_wait is meant to be used. From pthread_cond_wait(3):

Thanks.

Simon> +  pthread_mutex_lock (&g_mutex);
Simon> +  g_ready = true;
Simon> +  pthread_mutex_unlock (&g_mutex);
Simon>    pthread_cond_signal (&g_condvar);

I looked into this and TIL it's fine to pthread_cond_signal without
holding the lock.

Approved-By: Tom Tromey <tom@tromey.com>

Tom

  parent reply	other threads:[~2026-02-20 19:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 17:57 simon.marchi
2026-02-20 15:24 ` Simon Marchi
2026-02-20 19:05 ` Tom Tromey [this message]
2026-02-20 19:44   ` Simon Marchi

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=87cy1z1bhp.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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: link
Be 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