This is the mail archive of the
mailing list for the GDB project.
Re: [patch] Fix for PR gdb/10757
On Tuesday 27 October 2009 00:41:24, Paul Pluzhnikov wrote:
> static __volatile__ int thread_iteration_in_progress;
> static __volatile__ int thread_creation_in_progress;
> __pthread_create_2_1 (...)
> while (thread_iteration_in_progress) nanoslep ...;
> ... create new thread, put it on thread list ...
> return ...
> and in
> td_ta_thr_iter ()
> set thread_iteration_in_progress in the inferior to 1
> while (thread_creation_in_progress in inferior > 0)
> nanosleep ...
> iterate over the thread lists ...
> set thread_iteration_in_progress in inferior to 0
This does make the race window narrower, but it doesn't
completely kill it, as new threads could have passed the
thread_iteration_in_progress check already as gdb enters the
thread iteration loop.