File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public:
3636 /* *
3737 * Enqueue a function to be executed by the thread pool.
3838 */
39- void enqueue (const work_t & t);
39+ void enqueue (work_t t);
4040
4141 /* *
4242 * Execute work items until the queue is empty.
Original file line number Diff line number Diff line change @@ -41,12 +41,12 @@ void ThreadPool::shutdown()
4141 thr.join ();
4242}
4343
44- void ThreadPool::enqueue (const work_t & t)
44+ void ThreadPool::enqueue (work_t t)
4545{
4646 auto state (state_.lock ());
4747 if (quit)
4848 throw ThreadPoolShutDown (" cannot enqueue a work item while the thread pool is shutting down" );
49- state->pending .push (t );
49+ state->pending .push (std::move (t) );
5050 /* Note: process() also executes items, so count it as a worker. */
5151 if (state->pending .size () > state->workers .size () + 1 && state->workers .size () + 1 < maxThreads)
5252 state->workers .emplace_back (&ThreadPool::doWork, this , false );
You can’t perform that action at this time.
0 commit comments