mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Simplify logic for -thread-count:1
This commit is contained in:
@@ -4149,17 +4149,6 @@ void check_with_workers(Checker *c, WorkerTaskProc *proc, isize total_count) {
|
|||||||
|
|
||||||
semaphore_post(&c->info.collect_semaphore, cast(i32)thread_count);
|
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;
|
|
||||||
Thread 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;
|
||||||
|
|
||||||
@@ -4764,15 +4753,6 @@ void check_procedure_bodies(Checker *c) {
|
|||||||
u32 worker_count = thread_count-1; // NOTE(bill): The main thread will also be used for work
|
u32 worker_count = thread_count-1; // NOTE(bill): The main thread will also be used for work
|
||||||
if (!build_context.threaded_checker) {
|
if (!build_context.threaded_checker) {
|
||||||
worker_count = 0;
|
worker_count = 0;
|
||||||
|
|
||||||
auto *q = &c->procs_to_check_queue;
|
|
||||||
ProcInfo *pi = nullptr;
|
|
||||||
while (mpmc_dequeue(q, &pi)) {
|
|
||||||
consume_proc_info_queue(c, pi, q, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
debugf("Total Procedure Bodies Checked: %td\n", total_bodies_checked.load(std::memory_order_relaxed));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
global_procedure_body_in_worker_queue = true;
|
global_procedure_body_in_worker_queue = true;
|
||||||
|
|||||||
@@ -104,6 +104,14 @@ void thread_pool_do_task(WorkerTask *task) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void thread_pool_wait(ThreadPool *pool) {
|
void thread_pool_wait(ThreadPool *pool) {
|
||||||
|
if (pool->threads.count == 0) {
|
||||||
|
while (!thread_pool_queue_empty(pool)) {
|
||||||
|
thread_pool_do_task(thread_pool_queue_pop(pool));
|
||||||
|
--pool->ready;
|
||||||
|
}
|
||||||
|
GB_ASSERT(pool->ready == 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
mutex_lock(&pool->mutex);
|
mutex_lock(&pool->mutex);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user