aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/thread-pool.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-04-30 10:04:56 -0600
committerTom Tromey <tromey@adacore.com>2021-04-30 10:04:56 -0600
commit698facb837c556b0e189b92563ec8bd4f2de373d (patch)
treee9bb1281cce15de55c73a53f5e9be0828139f99e /gdbsupport/thread-pool.cc
parent2869ac4b59d58caf736f216f7bc65377116bd5f7 (diff)
downloadgdb-698facb837c556b0e189b92563ec8bd4f2de373d.zip
gdb-698facb837c556b0e189b92563ec8bd4f2de373d.tar.gz
gdb-698facb837c556b0e189b92563ec8bd4f2de373d.tar.bz2
Use rvalue reference in thread_pool::post_task
Tankut's recent patches made me realize that thread_pool::post_task should have used an rvalue reference for its parameter. This patch makes this change. gdbsupport/ChangeLog 2021-04-30 Tom Tromey <tromey@adacore.com> * thread-pool.cc (thread_pool::post_task): Update. * thread-pool.h (class thread_pool) <post_task>: Take rvalue reference to function.
Diffstat (limited to 'gdbsupport/thread-pool.cc')
-rw-r--r--gdbsupport/thread-pool.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdbsupport/thread-pool.cc b/gdbsupport/thread-pool.cc
index cd5e116..2bb75cc 100644
--- a/gdbsupport/thread-pool.cc
+++ b/gdbsupport/thread-pool.cc
@@ -130,9 +130,9 @@ thread_pool::set_thread_count (size_t num_threads)
}
std::future<void>
-thread_pool::post_task (std::function<void ()> func)
+thread_pool::post_task (std::function<void ()> &&func)
{
- std::packaged_task<void ()> t (func);
+ std::packaged_task<void ()> t (std::move (func));
std::future<void> f = t.get_future ();
if (m_thread_count == 0)