diff options
author | Tom Tromey <tom@tromey.com> | 2021-06-13 12:46:28 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-04-12 09:31:16 -0600 |
commit | f4565e4c99e768d3bcf2998979528569a65d8417 (patch) | |
tree | 51d6e54a3ba0a495cdedd2977d30a748920ea3cd /gdbsupport/thread-pool.cc | |
parent | 82d734f7a3b6f08813a9ad6272aa026779c88975 (diff) | |
download | gdb-f4565e4c99e768d3bcf2998979528569a65d8417.zip gdb-f4565e4c99e768d3bcf2998979528569a65d8417.tar.gz gdb-f4565e4c99e768d3bcf2998979528569a65d8417.tar.bz2 |
Return vector of results from parallel_for_each
This changes gdb::parallel_for_each to return a vector of the results.
However, if the passed-in function returns void, the return type
remains 'void'. This functionality is used later, to parallelize the
new indexer.
Diffstat (limited to 'gdbsupport/thread-pool.cc')
-rw-r--r-- | gdbsupport/thread-pool.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/gdbsupport/thread-pool.cc b/gdbsupport/thread-pool.cc index 7d44695..efd8b79 100644 --- a/gdbsupport/thread-pool.cc +++ b/gdbsupport/thread-pool.cc @@ -134,11 +134,10 @@ thread_pool::set_thread_count (size_t num_threads) #endif /* CXX_STD_THREAD */ } -std::future<void> -thread_pool::post_task (std::function<void ()> &&func) +void +thread_pool::do_post_task (std::packaged_task<void ()> &&func) { std::packaged_task<void ()> t (std::move (func)); - std::future<void> f = t.get_future (); #if CXX_STD_THREAD if (m_thread_count != 0) @@ -153,7 +152,6 @@ thread_pool::post_task (std::function<void ()> &&func) /* Just execute it now. */ t (); } - return f; } #if CXX_STD_THREAD |