Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-06-05 15:36:31 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-06-22 14:06:47 +0300
commit54e3487c9e80a489540a8a4c139ff147e6deb764 (patch)
tree3925a22786f105172c2ed255cb50fe027c0d3aa6 /intern/cycles/util
parentb10b7cdb43b07e67905ffdeba3639dd5f9806169 (diff)
Cleanup: remove task pool stop() and finished()
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_task.cpp33
-rw-r--r--intern/cycles/util/util_task.h3
2 files changed, 6 insertions, 30 deletions
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index b7a47c73571..eb07ec0bfa0 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -46,7 +46,7 @@ TaskPool::TaskPool()
TaskPool::~TaskPool()
{
- stop();
+ cancel();
}
void TaskPool::push(TaskRunFunction &&task, bool front)
@@ -135,24 +135,11 @@ void TaskPool::cancel()
do_cancel = false;
}
-void TaskPool::stop()
-{
- TaskScheduler::clear(this);
-
- assert(num == 0);
-}
-
bool TaskPool::canceled()
{
return do_cancel;
}
-bool TaskPool::finished()
-{
- thread_scoped_lock num_lock(num_mutex);
- return num == 0;
-}
-
void TaskPool::num_decrease(int done)
{
num_mutex.lock();
@@ -453,7 +440,11 @@ DedicatedTaskPool::DedicatedTaskPool()
DedicatedTaskPool::~DedicatedTaskPool()
{
- stop();
+ wait();
+
+ do_exit = true;
+ queue_cond.notify_all();
+
worker_thread->join();
delete worker_thread;
}
@@ -491,18 +482,6 @@ void DedicatedTaskPool::cancel()
do_cancel = false;
}
-void DedicatedTaskPool::stop()
-{
- clear();
-
- do_exit = true;
- queue_cond.notify_all();
-
- wait();
-
- assert(num == 0);
-}
-
bool DedicatedTaskPool::canceled()
{
return do_cancel;
diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h
index a3d277c8fa6..a7232e68f60 100644
--- a/intern/cycles/util/util_task.h
+++ b/intern/cycles/util/util_task.h
@@ -66,8 +66,6 @@ class TaskPool {
void wait_work(Summary *stats = NULL); /* work and wait until all tasks are done */
void cancel(); /* cancel all tasks, keep worker threads running */
- void stop(); /* stop all worker threads */
- bool finished(); /* check if all work has been completed */
bool canceled(); /* for worker threads, test if canceled */
@@ -155,7 +153,6 @@ class DedicatedTaskPool {
void wait(); /* wait until all tasks are done */
void cancel(); /* cancel all tasks, keep worker thread running */
- void stop(); /* stop worker thread */
bool canceled(); /* for worker thread, test if canceled */