diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-06-05 11:37:45 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-06-22 14:06:47 +0300 |
commit | b7c34c889b6158d542648f31133f201d330201eb (patch) | |
tree | efa9edcb1e27945a0b218d2ff666526b2bd8d2aa /intern/cycles/util | |
parent | f9d138be51e6f28b4796ac3959c6ff2ed6c5d1c7 (diff) |
Cleanup: use move semantics for task pool functions
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_task.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/util/util_task.h | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp index 61aa28c6815..3599c99eb96 100644 --- a/intern/cycles/util/util_task.cpp +++ b/intern/cycles/util/util_task.cpp @@ -59,9 +59,9 @@ void TaskPool::push(Task *task, bool front) TaskScheduler::push(entry, front); } -void TaskPool::push(const TaskRunFunction &run, bool front) +void TaskPool::push(TaskRunFunction &&run, bool front) { - push(new Task(run), front); + push(new Task(std::move(run)), front); } void TaskPool::wait_work(Summary *stats) @@ -478,9 +478,9 @@ void DedicatedTaskPool::push(Task *task, bool front) queue_mutex.unlock(); } -void DedicatedTaskPool::push(const TaskRunFunction &run, bool front) +void DedicatedTaskPool::push(TaskRunFunction &&run, bool front) { - push(new Task(run), front); + push(new Task(std::move(run)), front); } void DedicatedTaskPool::wait() diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h index fd30a33d8ef..17ff47cb2d8 100644 --- a/intern/cycles/util/util_task.h +++ b/intern/cycles/util/util_task.h @@ -51,7 +51,7 @@ typedef function<void(int thread_id)> TaskRunFunction; class Task { public: Task(){}; - explicit Task(const TaskRunFunction &run_) : run(run_) + explicit Task(TaskRunFunction &&run_) : run(run_) { } @@ -90,7 +90,7 @@ class TaskPool { ~TaskPool(); void push(Task *task, bool front = false); - void push(const TaskRunFunction &run, bool front = false); + void push(TaskRunFunction &&run, bool front = false); void wait_work(Summary *stats = NULL); /* work and wait until all tasks are done */ void cancel(); /* cancel all tasks, keep worker threads running */ @@ -180,7 +180,7 @@ class DedicatedTaskPool { ~DedicatedTaskPool(); void push(Task *task, bool front = false); - void push(const TaskRunFunction &run, bool front = false); + void push(TaskRunFunction &&run, bool front = false); void wait(); /* wait until all tasks are done */ void cancel(); /* cancel all tasks, keep worker thread running */ |