mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 11:50:07 +00:00
Short circuit check_with_workers logic on worker_count == 0
This commit is contained in:
+13
-2
@@ -4078,7 +4078,18 @@ void check_with_workers(Checker *c, gbThreadProc *proc, isize total_count) {
|
|||||||
worker_count = 0;
|
worker_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gb_semaphore_post(&c->info.collect_semaphore, cast(i32)worker_count);
|
gb_semaphore_post(&c->info.collect_semaphore, cast(i32)thread_count);
|
||||||
|
|
||||||
|
if (worker_count == 0) {
|
||||||
|
ThreadProcCheckerSection section_all = {};
|
||||||
|
section_all.checker = c;
|
||||||
|
section_all.offset = 0;
|
||||||
|
section_all.count = total_count;
|
||||||
|
gbThread dummy_main_thread = {};
|
||||||
|
dummy_main_thread.user_data = §ion_all;
|
||||||
|
proc(&dummy_main_thread);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isize file_load_count = (total_count+thread_count-1)/thread_count;
|
isize file_load_count = (total_count+thread_count-1)/thread_count;
|
||||||
isize remaining_count = total_count;
|
isize remaining_count = total_count;
|
||||||
@@ -4713,7 +4724,7 @@ void check_procedure_bodies(Checker *c) {
|
|||||||
GB_ASSERT(total_queued == original_queue_count);
|
GB_ASSERT(total_queued == original_queue_count);
|
||||||
|
|
||||||
|
|
||||||
gb_semaphore_post(&c->procs_to_check_semaphore, cast(i32)worker_count);
|
gb_semaphore_post(&c->procs_to_check_semaphore, cast(i32)thread_count);
|
||||||
|
|
||||||
gbThread *threads = gb_alloc_array(permanent_allocator(), gbThread, worker_count);
|
gbThread *threads = gb_alloc_array(permanent_allocator(), gbThread, worker_count);
|
||||||
for (isize i = 0; i < worker_count; i++) {
|
for (isize i = 0; i < worker_count; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user