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:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /intern/cycles/util/util_thread.cpp
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'intern/cycles/util/util_thread.cpp')
-rw-r--r--intern/cycles/util/util_thread.cpp57
1 files changed, 27 insertions, 30 deletions
diff --git a/intern/cycles/util/util_thread.cpp b/intern/cycles/util/util_thread.cpp
index f3c6077f6b7..cccde5ae7d5 100644
--- a/intern/cycles/util/util_thread.cpp
+++ b/intern/cycles/util/util_thread.cpp
@@ -21,54 +21,51 @@
CCL_NAMESPACE_BEGIN
-thread::thread(function<void()> run_cb, int node)
- : run_cb_(run_cb),
- joined_(false),
- node_(node)
+thread::thread(function<void()> run_cb, int node) : run_cb_(run_cb), joined_(false), node_(node)
{
#ifdef __APPLE__
- /* Set the stack size to 2MB to match Linux. The default 512KB on macOS is
- * too small for Embree, and consistent stack size also makes things more
- * predictable in general. */
- pthread_attr_t attribute;
- pthread_attr_init(&attribute);
- pthread_attr_setstacksize(&attribute, 1024*1024*2);
- pthread_create(&pthread_id, &attribute, run, (void*)this);
+ /* Set the stack size to 2MB to match Linux. The default 512KB on macOS is
+ * too small for Embree, and consistent stack size also makes things more
+ * predictable in general. */
+ pthread_attr_t attribute;
+ pthread_attr_init(&attribute);
+ pthread_attr_setstacksize(&attribute, 1024 * 1024 * 2);
+ pthread_create(&pthread_id, &attribute, run, (void *)this);
#else
- std_thread = std::thread(&thread::run, this);
+ std_thread = std::thread(&thread::run, this);
#endif
}
thread::~thread()
{
- if(!joined_) {
- join();
- }
+ if (!joined_) {
+ join();
+ }
}
void *thread::run(void *arg)
{
- thread *self = (thread*)(arg);
- if (self->node_ != -1) {
- system_cpu_run_thread_on_node(self->node_);
- }
- self->run_cb_();
- return NULL;
+ thread *self = (thread *)(arg);
+ if (self->node_ != -1) {
+ system_cpu_run_thread_on_node(self->node_);
+ }
+ self->run_cb_();
+ return NULL;
}
bool thread::join()
{
- joined_ = true;
+ joined_ = true;
#ifdef __APPLE__
- return pthread_join(pthread_id, NULL) == 0;
+ return pthread_join(pthread_id, NULL) == 0;
#else
- try {
- std_thread.join();
- return true;
- }
- catch (const std::system_error&) {
- return false;
- }
+ try {
+ std_thread.join();
+ return true;
+ }
+ catch (const std::system_error &) {
+ return false;
+ }
#endif
}