diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-06-04 02:29:13 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-06-06 10:14:37 +0300 |
commit | b62faa54de70fd8a4125c98cce2d12f3291139fc (patch) | |
tree | 64cae6f76c23212ff2dc93b26eef9647386aea1a /intern/cycles/util/util_thread.h | |
parent | 9d090ed1cde2ae75c36548ed31daae10f121317a (diff) |
Cycles: Add support of processor groups
Currently for windows only, this is an initial commit towards native
support of NUMA.
Current commit makes it so Cycles will use all logical processors on
Windows running on system with more than 64 threads.
Reviewers: juicyfruit, dingto, lukasstockner97, maiself, brecht
Subscribers: LazyDodo
Differential Revision: https://developer.blender.org/D2049
Diffstat (limited to 'intern/cycles/util/util_thread.h')
-rw-r--r-- | intern/cycles/util/util_thread.h | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h index 59575f31c13..427c633d2ce 100644 --- a/intern/cycles/util/util_thread.h +++ b/intern/cycles/util/util_thread.h @@ -52,37 +52,17 @@ typedef boost::condition_variable thread_condition_variable; class thread { public: - thread(function<void(void)> run_cb_) + thread(function<void(void)> run_cb, int group = -1); + ~thread(); - { - joined = false; - run_cb = run_cb_; - - pthread_create(&pthread_id, NULL, run, (void*)this); - } - - ~thread() - { - if(!joined) - join(); - } - - static void *run(void *arg) - { - ((thread*)arg)->run_cb(); - return NULL; - } - - bool join() - { - joined = true; - return pthread_join(pthread_id, NULL) == 0; - } + static void *run(void *arg); + bool join(); protected: - function<void(void)> run_cb; - pthread_t pthread_id; - bool joined; + function<void(void)> run_cb_; + pthread_t pthread_id_; + bool joined_; + int group_; }; /* Own wrapper around pthread's spin lock to make it's use easier. */ |