]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Introduce gdbsupport/cxx-thread.h and use it
authorTom Tromey <tromey@adacore.com>
Wed, 1 Oct 2025 16:27:15 +0000 (10:27 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 2 Oct 2025 17:55:14 +0000 (11:55 -0600)
commit2caf7b168912aaff869d4b13f6130baeaa45cb76
tree7601b700c5d889fe5b602bde9b7d1423a6460a38
parent29c3f00511bbde3190509bde506a0fee555b71b1
Introduce gdbsupport/cxx-thread.h and use it

This introduces a new file, gdbsupport/cxx-thread.h, which provides
stubs for the C++ threading functionality on systems that don't
support it.

On fully-working ports, this header just supplies a number of aliases
in the gdb namespace.  So, for instance, gdb::mutex is just an alias
for std::mutex.

For non-working ports, compatibility stubs are provided for the subset
of threading functionality that's used in gdb.  These generally do
nothing and assume single-threaded operation.

The idea behind this is to reduce the number of checks of
CXX_STD_THREAD, making the code cleaner.

Not all spots using CXX_STD_THREAD could readily be converted.
In particular:

* Unit tests
* --config output
* Code manipulating threads themselves
* The extension interrupting handling code

These all seem fine to me.

Note there's also a check in py-dap.c.  This one is perhaps slightly
subtle: DAP starts threads on the Python side, but it relies on gdb
itself being thread-savvy, for instance in gdb.post_event.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/complaints.c
gdb/dwarf2/cooked-index-worker.c
gdb/dwarf2/cooked-index-worker.h
gdb/dwarf2/read.c
gdb/dwarf2/read.h
gdb/gdb_bfd.c
gdb/minsyms.c
gdb/run-on-main-thread.c
gdbsupport/cxx-thread.h [new file with mode: 0644]
gdbsupport/thread-pool.h