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:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-09-17 16:07:06 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-09-17 16:07:06 +0400
commitefaf512406c71606d7f05eca10c74510bd9ebc12 (patch)
treed42a01041ba165f13ad1b3c42bc118bd3c82b0c3 /intern/cycles/util
parentaecb2f7039f0af91bd1eb03a64957bcd532c9408 (diff)
Revert r50528: "Performance fix for Cycles: Don't wait in the main UI thread when resetting devices."
This commit leads to random freezes in Cycles rendering: https://projects.blender.org/tracker/index.php?func=detail&aid=32545&group_id=9&atid=498 The goal of this commit was to remove UI lag for OSL, but since that is not officially supported yet, better revert it until a proper fix can be implemented in 2.65.
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_task.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index 2b209c135f4..ea0abd6f54f 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -38,8 +38,6 @@ TaskPool::~TaskPool()
void TaskPool::push(Task *task, bool front)
{
- thread_scoped_lock num_lock(num_mutex);
-
TaskScheduler::Entry entry;
entry.task = task;
@@ -104,17 +102,22 @@ void TaskPool::wait_work()
void TaskPool::cancel()
{
- thread_scoped_lock num_lock(num_mutex);
-
do_cancel = true;
TaskScheduler::clear(this);
+
+ {
+ thread_scoped_lock num_lock(num_mutex);
+
+ while(num)
+ num_cond.wait(num_lock);
+ }
+
+ do_cancel = false;
}
void TaskPool::stop()
{
- thread_scoped_lock num_lock(num_mutex);
-
TaskScheduler::clear(this);
assert(num == 0);
@@ -127,20 +130,20 @@ bool TaskPool::cancelled()
void TaskPool::num_decrease(int done)
{
+ num_mutex.lock();
num -= done;
+
assert(num >= 0);
-
- if(num == 0) {
- do_cancel = false;
-
+ if(num == 0)
num_cond.notify_all();
- }
+
+ num_mutex.unlock();
}
void TaskPool::num_increase()
{
+ thread_scoped_lock num_lock(num_mutex);
num++;
-
num_cond.notify_all();
}
@@ -236,11 +239,7 @@ void TaskScheduler::thread_run(int thread_id)
delete entry.task;
/* notify pool task was done */
- {
- /* not called from TaskPool, have to explicitly lock the mutex here */
- thread_scoped_lock num_lock(entry.pool->num_mutex);
- entry.pool->num_decrease(1);
- }
+ entry.pool->num_decrease(1);
}
}