public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [pushed] Fix thread-less build
Date: Tue,  9 Jan 2024 13:23:47 -0700	[thread overview]
Message-ID: <20240109202347.339446-1-tom@tromey.com> (raw)

A user pointed out that the recent background DWARF reader series
broke the build when --disable-threading is in use.  This patch fixes
the problem.  I am checking it in.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31223
---
 gdb/dwarf2/cooked-index.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index b14930d558f..a26163f1c41 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -517,18 +517,18 @@ class cooked_index_worker
 #if CXX_STD_THREAD
   /* Current state of this object.  */
   cooked_state m_state = cooked_state::INITIAL;
+  /* Mutex and condition variable used to synchronize.  */
+  std::mutex m_mutex;
+  std::condition_variable m_cond;
+#endif /* CXX_STD_THREAD */
   /* This flag indicates whether any complaints or exceptions that
      arose during scanning have been reported by 'wait'.  This may
      only be modified on the main thread.  */
   bool m_reported = false;
-  /* Mutex and condition variable used to synchronize.  */
-  std::mutex m_mutex;
-  std::condition_variable m_cond;
   /* If set, an exception occurred during start_reading; in this case
      the scanning is stopped and this exception will later be reported
      by the 'wait' method.  */
   std::optional<gdb_exception> m_failed;
-#endif /* CXX_STD_THREAD */
 };
 
 /* The main index of DIEs.
-- 
2.43.0


                 reply	other threads:[~2024-01-09 20:24 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=20240109202347.339446-1-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@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).