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:
authorBastien Montagne <montagne29@wanadoo.fr>2017-04-14 13:36:56 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-04-14 13:39:54 +0300
commit95b36321126fd6f9563b309930ac9ae6cf422a81 (patch)
tree0722b78d4ffc69d49926d34d7ac0a9816c30dacd /source/blender/blenlib
parent6cda217a82078d7bdf61caec458154a507a58947 (diff)
parent0b55b8cc6a37fa4e74c55c9ccb54950c5f546bd6 (diff)
Merge branch 'master' into blender2.8
Conflicts: source/blender/alembic/intern/abc_exporter.cc
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/task.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c
index c92881bb741..eb4e6e91aee 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -168,6 +168,9 @@ struct TaskPool {
*/
bool use_local_tls;
TaskThreadLocalStorage local_tls;
+#ifndef NDEBUG
+ pthread_t creator_thread_id;
+#endif
#ifdef DEBUG_STATS
TaskMemPoolStats *mempool_stats;
@@ -220,11 +223,14 @@ BLI_INLINE TaskThreadLocalStorage *get_task_tls(TaskPool *pool,
TaskScheduler *scheduler = pool->scheduler;
BLI_assert(thread_id >= 0);
BLI_assert(thread_id <= scheduler->num_threads);
- if (pool->use_local_tls) {
+ if (pool->use_local_tls && thread_id == 0) {
BLI_assert(pool->thread_id == 0);
+ BLI_assert(!BLI_thread_is_main());
+ BLI_assert(pthread_equal(pthread_self(), pool->creator_thread_id));
return &pool->local_tls;
}
if (thread_id == 0) {
+ BLI_assert(BLI_thread_is_main());
return &scheduler->task_threads[pool->thread_id].tls;
}
return &scheduler->task_threads[thread_id].tls;
@@ -268,6 +274,9 @@ static void task_free(TaskPool *pool, Task *task, const int thread_id)
task_data_free(task, thread_id);
BLI_assert(thread_id >= 0);
BLI_assert(thread_id <= pool->scheduler->num_threads);
+ if (thread_id == 0) {
+ BLI_assert(pool->use_local_tls || BLI_thread_is_main());
+ }
TaskThreadLocalStorage *tls = get_task_tls(pool, thread_id);
TaskMemPool *task_mempool = &tls->task_mempool;
if (task_mempool->num_tasks < MEMPOOL_SIZE - 1) {
@@ -613,6 +622,9 @@ static TaskPool *task_pool_create_ex(TaskScheduler *scheduler,
*/
pool->thread_id = 0;
pool->use_local_tls = true;
+#ifndef NDEBUG
+ pool->creator_thread_id = pthread_self();
+#endif
initialize_task_tls(&pool->local_tls);
}
else {