From b7c34c889b6158d542648f31133f201d330201eb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 5 Jun 2020 10:37:45 +0200 Subject: Cleanup: use move semantics for task pool functions --- intern/cycles/util/util_task.cpp | 8 ++++---- intern/cycles/util/util_task.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'intern') 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 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 */ -- cgit v1.2.3