Allow thread-pool.h to work without threads
authorTom Tromey <tom@tromey.com>
Thu, 31 Mar 2022 02:19:54 +0000 (20:19 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 12 Apr 2022 15:31:15 +0000 (09:31 -0600)
commit0981fe1017a8111aa6544ff52bcbbc80eec6b3c0
tree094cc0549f9ec7c55276027466718155597c7682
parent8e6b35366073a1a71df805061ecf016cc915a9f9
Allow thread-pool.h to work without threads

thread-pool.h requires CXX_STD_THREAD in order to even be included.
However, there's no deep reason for this, and during review we found
that one patch in the new DWARF indexer series unconditionally
requires the thread pool.

Because the thread pool already allows a task to be run in the calling
thread (for example if it is configured to have no threads in the
pool), it seemed straightforward to make this code ok to use when host
threads aren't available at all.

This patch implements this idea.  I built it on a thread-less host
(mingw, before my recent configure patch) and verified that the result
builds.

After the thread-pool change, parallel-for.h no longer needs any
CXX_STD_THREAD checks at all, so this patch removes these as well.
gdb/maint.c
gdbsupport/parallel-for.h
gdbsupport/thread-pool.cc
gdbsupport/thread-pool.h