diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-01 16:23:08 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-01 16:25:35 +0300 |
commit | f318e8322f2e339ce6e918fca9146334f84f6990 (patch) | |
tree | c1374eb0c2bcfe6e4e53e72d0374ec3c3051bf22 /intern/cycles/util/util_task.cpp | |
parent | c6b27dd4fa02b2609a18ce3aa9c71b64e12b500d (diff) |
Cycles: Report thread ID from worker thread to callbacks
Main use case of this ID will be to emulate TLS which otherwise
would require having some platform-specific implementations which
is not always really optimal.
See notes about the argument in util_task.h.
Diffstat (limited to 'intern/cycles/util/util_task.cpp')
-rw-r--r-- | intern/cycles/util/util_task.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp index 5523f373824..28bbc8856c6 100644 --- a/intern/cycles/util/util_task.cpp +++ b/intern/cycles/util/util_task.cpp @@ -89,7 +89,7 @@ void TaskPool::wait_work() /* if found task, do it, otherwise wait until other tasks are done */ if(found_entry) { /* run task */ - work_entry.task->run(); + work_entry.task->run(0); /* delete task */ delete work_entry.task; @@ -192,7 +192,7 @@ void TaskScheduler::init(int num_threads) threads.resize(num_threads); for(size_t i = 0; i < threads.size(); i++) - threads[i] = new thread(function_bind(&TaskScheduler::thread_run, i)); + threads[i] = new thread(function_bind(&TaskScheduler::thread_run, i + 1)); } users++; @@ -243,7 +243,7 @@ bool TaskScheduler::thread_wait_pop(Entry& entry) return true; } -void TaskScheduler::thread_run(int /*thread_id*/) +void TaskScheduler::thread_run(int thread_id) { Entry entry; @@ -252,7 +252,7 @@ void TaskScheduler::thread_run(int /*thread_id*/) /* keep popping off tasks */ while(thread_wait_pop(entry)) { /* run task */ - entry.task->run(); + entry.task->run(thread_id); /* delete task */ delete entry.task; @@ -419,7 +419,7 @@ void DedicatedTaskPool::thread_run() /* keep popping off tasks */ while(thread_wait_pop(task)) { /* run task */ - task->run(); + task->run(0); /* delete task */ delete task; |