Re: [PATCH] gdb/testsuite: fix race condition in gdb.replay/missing-thread.c

Simon Marchi
2026-02-20T19:45:11Z

On 2/20/26 2:05 PM, Tom Tromey wrote:
>>>>>> "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

Thanks, this will make my CI jobs much happier. Pushed.

Simon