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.h | |
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.h')
-rw-r--r-- | intern/cycles/util/util_task.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h index a8e1963252a..2ce26fa7103 100644 --- a/intern/cycles/util/util_task.h +++ b/intern/cycles/util/util_task.h @@ -27,7 +27,21 @@ class Task; class TaskPool; class TaskScheduler; -typedef function<void(void)> TaskRunFunction; +/* Notes on Thread ID + * + * Thread ID argument reports the 0-based ID of a working thread from which + * the run() callback is being invoked. Thread ID of 0 denotes the thread from + * which wait_work() was called. + * + * DO NOT use this ID to control execution flaw, use it only for things like + * emulating TLS which does not affect on scheduling. Don't use this ID to make + * any decisions. + * + * It is to be noted here that dedicated task pool will always report thread ID + * of 0. + */ + +typedef function<void(int thread_id)> TaskRunFunction; /* Task * |