aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/thread-pool.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-05-09 11:48:40 -0600
committerTom Tromey <tromey@adacore.com>2022-05-10 08:15:40 -0600
commit20c4eb4226997c0de0a47d5d4c6c2eed21ed9af4 (patch)
treedb0fd93a83d261b61d2a107d823212a4e8c6c271 /gdbsupport/thread-pool.cc
parentc7d029ea9cc566b8d3c50b08ef12d98394adf1b1 (diff)
downloadgdb-20c4eb4226997c0de0a47d5d4c6c2eed21ed9af4.zip
gdb-20c4eb4226997c0de0a47d5d4c6c2eed21ed9af4.tar.gz
gdb-20c4eb4226997c0de0a47d5d4c6c2eed21ed9af4.tar.bz2
Fix --disable-threading build
PR build/29110 points out that GDB fails to build on mingw when the "win32" thread model is in use. It turns out that the Fedora cross tools using the "posix" thread model, which somehow manages to support std::future, whereas the win32 model does not. While looking into this, I found that the configuring with --disable-threading will also cause a build failure. This patch fixes this build by introducing a compatibility wrapper for std::future. I am not able to test the win32 thread model build, but I'm going to ask the reporter to try this patch. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29110
Diffstat (limited to 'gdbsupport/thread-pool.cc')
-rw-r--r--gdbsupport/thread-pool.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/gdbsupport/thread-pool.cc b/gdbsupport/thread-pool.cc
index 3674e91..ddb76b69 100644
--- a/gdbsupport/thread-pool.cc
+++ b/gdbsupport/thread-pool.cc
@@ -192,12 +192,13 @@ thread_pool::set_thread_count (size_t num_threads)
#endif /* CXX_STD_THREAD */
}
+#if CXX_STD_THREAD
+
void
thread_pool::do_post_task (std::packaged_task<void ()> &&func)
{
std::packaged_task<void ()> t (std::move (func));
-#if CXX_STD_THREAD
if (m_thread_count != 0)
{
std::lock_guard<std::mutex> guard (m_tasks_mutex);
@@ -205,15 +206,12 @@ thread_pool::do_post_task (std::packaged_task<void ()> &&func)
m_tasks_cv.notify_one ();
}
else
-#endif
{
/* Just execute it now. */
t ();
}
}
-#if CXX_STD_THREAD
-
void
thread_pool::thread_function ()
{