Skip to content

Commit

Permalink
libcore: Improved async() method
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Nov 3, 2018
1 parent a1866d0 commit 8fcfb35
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doomsday/sdk/libcore/include/de/concurrency/async.h
Expand Up @@ -72,9 +72,9 @@ class AsyncTaskThread : public AsyncTask
}

public:
AsyncTaskThread(Task const &task, Completion const &completion)
: task(task)
, completion(completion)
AsyncTaskThread(Task task, Completion completion)
: task(std::move(task))
, completion(std::move(completion))
, valid(true)
{}

Expand Down Expand Up @@ -119,10 +119,10 @@ class AsyncTaskThread : public AsyncTask
* callback has been called. You can pass this to AsyncScope for keeping track of.
*/
template <typename Task, typename Completion>
AsyncTask *async(Task const &task, Completion const &completion)
AsyncTask *async(Task task, Completion completion)
{
DENG2_ASSERT_IN_MAIN_THREAD();
auto *t = new internal::AsyncTaskThread<Task, Completion>(task, completion);
auto *t = new internal::AsyncTaskThread<Task, Completion>(std::move(task), std::move(completion));
t->start();
// Note: The thread will delete itself when finished.
return t;
Expand Down

0 comments on commit 8fcfb35

Please sign in to comment.