diff options
Diffstat (limited to 'source/blender/blenlib/intern/task.c')
-rw-r--r-- | source/blender/blenlib/intern/task.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index c05634d3062..9d57d16d8b2 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -363,12 +363,13 @@ static bool task_scheduler_thread_wait_pop(TaskScheduler *scheduler, Task **task do { Task *current_task; - /* Assuming we can only have a void queue in 'exit' case here seems logical (we should only be here after - * our worker thread has been woken up from a condition_wait(), which only happens after a new task was - * added to the queue), but it is wrong. - * Waiting on condition may wake up the thread even if condition is not signaled (spurious wake-ups), and some - * race condition may also empty the queue **after** condition has been signaled, but **before** awoken thread - * reaches this point... + /* Assuming we can only have a void queue in 'exit' case here seems logical + * (we should only be here after our worker thread has been woken up from a + * condition_wait(), which only happens after a new task was added to the queue), + * but it is wrong. + * Waiting on condition may wake up the thread even if condition is not signaled + * (spurious wake-ups), and some race condition may also empty the queue **after** + * condition has been signaled, but **before** awoken thread reaches this point... * See http://stackoverflow.com/questions/8594591 * * So we only abort here if do_exit is set. @@ -634,7 +635,8 @@ static TaskPool *task_pool_create_ex(TaskScheduler *scheduler, TaskPool *pool = MEM_mallocN(sizeof(TaskPool), "TaskPool"); #ifndef NDEBUG - /* Assert we do not try to create a background pool from some parent task - those only work OK from main thread. */ + /* Assert we do not try to create a background pool from some parent task - + * those only work OK from main thread. */ if (is_background) { const pthread_t thread_id = pthread_self(); int i = scheduler->num_threads; |