From: Pedro Alves <pedro@codesourcery.com>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix for PR gdb/10757
Date: Tue, 27 Oct 2009 09:43:00 -0000 [thread overview]
Message-ID: <200910270943.33164.pedro@codesourcery.com> (raw)
In-Reply-To: <8ac60eac0910261741y3db8faekb7aef4305d6c2e4d@mail.gmail.com>
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 ...;
> atomic_increment(&thread_creation_in_progress);
> ... create new thread, put it on thread list ...
> atomic_decrement(&thread_creation_in_progress);
> 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.
--
Pedro Alves
next prev parent reply other threads:[~2009-10-27 9:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 19:10 Paul Pluzhnikov
2009-10-17 23:26 ` Paul Pluzhnikov
2009-10-25 17:15 ` Paul Pluzhnikov
2009-10-25 23:54 ` Pedro Alves
2009-10-26 21:25 ` Paul Pluzhnikov
2009-10-26 21:34 ` Pedro Alves
2009-10-27 0:41 ` Paul Pluzhnikov
2009-10-27 9:43 ` Pedro Alves [this message]
2009-10-27 16:58 ` Paul Pluzhnikov
2009-10-27 21:38 ` Paul Pluzhnikov
2009-10-27 21:52 ` Pedro Alves
2009-10-28 17:04 ` Paul Pluzhnikov
2009-10-25 23:59 Pedro Alves
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=200910270943.33164.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=ppluzhnikov@google.com \
/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