public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug dap/30680] [gdb/dap] ThreadSanitizer: data race gdbsupport/event-pipe.h:44 in event_pipe::is_open() const
Date: Fri, 28 Jul 2023 11:01:55 +0000	[thread overview]
Message-ID: <bug-30680-4717-DFF3QZ9syR@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30680-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30680

--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #6)
> diff --git a/gdb/run-on-main-thread.c b/gdb/run-on-main-thread.c
> index c7d9de0afc8..f9388e33633 100644
> --- a/gdb/run-on-main-thread.c
> +++ b/gdb/run-on-main-thread.c
> @@ -94,12 +94,27 @@ run_on_main_thread (std::function<void ()> &&func)
>    serial_event_set (runnable_event);
>  }
>  
> +#if CXX_STD_THREAD
> +static void
> +initialize_main_thread_var (void)
> +{
> +  static bool initialized = false;
> +
> +  if (initialized)
> +    return;
> +  initialized = true;
> +
> +  main_thread = std::this_thread::get_id ();
> +}
> +#endif
> +
>  /* See run-on-main-thread.h.  */
>  
>  bool
>  is_main_thread ()
>  {
>  #if CXX_STD_THREAD
> +  initialize_main_thread_var ();
>    return std::this_thread::get_id () == main_thread;
>  #else--
>    return true;
> @@ -111,7 +126,7 @@ void
>  _initialize_run_on_main_thread ()
>  {
>  #if CXX_STD_THREAD
> -  main_thread = std::this_thread::get_id ();
> +  initialize_main_thread_var ();
>  #endif
>    runnable_event = make_serial_event ();
>    add_file_handler (serial_event_fd (runnable_event), run_events, nullptr,
> ...

Submitted this bit here (
https://sourceware.org/pipermail/gdb-patches/2023-July/201190.html ).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-07-28 11:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 10:33 [Bug dap/30680] New: " vries at gcc dot gnu.org
2023-07-25 10:46 ` [Bug dap/30680] " vries at gcc dot gnu.org
2023-07-25 11:10 ` vries at gcc dot gnu.org
2023-07-25 11:51 ` vries at gcc dot gnu.org
2023-07-25 12:36 ` tromey at sourceware dot org
2023-07-26 12:12 ` vries at gcc dot gnu.org
2023-07-26 16:23 ` vries at gcc dot gnu.org
2023-07-26 16:57 ` vries at gcc dot gnu.org
2023-07-26 16:59 ` vries at gcc dot gnu.org
2023-07-28 11:01 ` vries at gcc dot gnu.org [this message]
2023-07-28 16:04 ` tromey at sourceware dot org
2023-07-28 16:20 ` vries at gcc dot gnu.org
2023-07-28 17:58 ` tromey at sourceware dot org
2023-07-28 18:10 ` tromey at sourceware dot org
2023-07-31 12:37 ` cvs-commit at gcc dot gnu.org
2023-07-31 12:38 ` tromey at sourceware dot org

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=bug-30680-4717-DFF3QZ9syR@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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: 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).