public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Add final cleanup for runnables Date: Tue, 27 Feb 2024 17:38:39 +0000 (GMT) [thread overview] Message-ID: <20240227173839.1A1BE3858C5E@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6313c05640cf6e2f6b1b1b8e66789b34b45f19c7 commit 6313c05640cf6e2f6b1b1b8e66789b34b45f19c7 Author: Tom Tromey <tromey@adacore.com> Date: Fri Feb 23 13:26:02 2024 -0700 Add final cleanup for runnables This changes run-on-main-thread.c to clear 'runnables' in a final cleanup. This avoids an issue where a pending runnable could require Python, but be run after the Python interpreter was finalized. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31172 Diff: --- gdb/run-on-main-thread.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gdb/run-on-main-thread.c b/gdb/run-on-main-thread.c index 2d40048de56..7b9807e0eaf 100644 --- a/gdb/run-on-main-thread.c +++ b/gdb/run-on-main-thread.c @@ -133,4 +133,15 @@ _initialize_run_on_main_thread () runnable_event = make_serial_event (); add_file_handler (serial_event_fd (runnable_event), run_events, nullptr, "run-on-main-thread"); + + /* A runnable may refer to an extension language. So, we want to + make sure any pending ones have been deleted before the extension + languages are shut down. */ + add_final_cleanup ([] () + { +#if CXX_STD_THREAD + std::lock_guard lock (runnable_mutex); +#endif + runnables.clear (); + }); }
reply other threads:[~2024-02-27 17:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240227173839.1A1BE3858C5E@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).