Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/task.c
| Show First 20 Lines • Show All 423 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void *task_scheduler_thread_run(void *thread_p) | static void *task_scheduler_thread_run(void *thread_p) | ||||
| { | { | ||||
| TaskThread *thread = (TaskThread *)thread_p; | TaskThread *thread = (TaskThread *)thread_p; | ||||
| TaskThreadLocalStorage *tls = &thread->tls; | TaskThreadLocalStorage *tls = &thread->tls; | ||||
| TaskScheduler *scheduler = thread->scheduler; | TaskScheduler *scheduler = thread->scheduler; | ||||
| int thread_id = thread->id; | int thread_id = thread->id; | ||||
| Task *task; | Task *task; | ||||
velocity: this is fixed locally | |||||
| BLI_thread_name_set("Task Scheduler"); | |||||
| pthread_setspecific(scheduler->tls_id_key, thread); | pthread_setspecific(scheduler->tls_id_key, thread); | ||||
| /* signal the main thread when all threads have started */ | /* signal the main thread when all threads have started */ | ||||
| BLI_mutex_lock(&scheduler->startup_mutex); | BLI_mutex_lock(&scheduler->startup_mutex); | ||||
| scheduler->num_thread_started++; | scheduler->num_thread_started++; | ||||
| if (scheduler->num_thread_started == scheduler->num_threads) { | if (scheduler->num_thread_started == scheduler->num_threads) { | ||||
| BLI_condition_notify_one(&scheduler->startup_cond); | BLI_condition_notify_one(&scheduler->startup_cond); | ||||
| } | } | ||||
Done Inline ActionsI'm not sure this is a great idea to change thread name in a very hot function. Surely, is not such of a problem for release builds, but we do debug complex production scenes in a debug mode. Also, this doesn't bring a lot of new information and is not complete information. Thread which does wait_and_work is not renamed and there you can not reliably have this wait/run semantic working without having some sort of TLS stack of all names. Don't even think it worth it. sergey: I'm not sure this is a great idea to change thread name in a very hot function. Surely, is not… | |||||
Done Inline ActionsYeah that makes sense, I'll remove it. velocity: Yeah that makes sense, I'll remove it. | |||||
| BLI_mutex_unlock(&scheduler->startup_mutex); | BLI_mutex_unlock(&scheduler->startup_mutex); | ||||
| /* keep popping off tasks */ | /* keep popping off tasks */ | ||||
| while (task_scheduler_thread_wait_pop(scheduler, &task)) { | while (task_scheduler_thread_wait_pop(scheduler, &task)) { | ||||
| TaskPool *pool = task->pool; | TaskPool *pool = task->pool; | ||||
| /* run task */ | /* run task */ | ||||
| BLI_assert(!tls->do_delayed_push); | BLI_assert(!tls->do_delayed_push); | ||||
| ▲ Show 20 Lines • Show All 1,024 Lines • Show Last 20 Lines | |||||
this is fixed locally