aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-08-26 21:40:54 +0100
committergingerBill <bill@gingerbill.org>2021-08-26 21:40:54 +0100
commit6d49df1d87fb1d74f00977dee3a3ce42c46c1eee (patch)
treef62394981d7554acdddac3d3e68c60daa7af23a8
parentac191bd31f2983942e297beba077484ba58922f4 (diff)
Don't use the thread pool if worker count is 0
-rw-r--r--src/checker.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index c93837321..e3af570f8 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -4146,8 +4146,16 @@ void check_with_workers(Checker *c, WorkerTaskProc *proc, isize total_count) {
if (!build_context.threaded_checker) {
worker_count = 0;
}
-
+
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;
+ proc(&section_all);
+ return;
+ }
isize file_load_count = (total_count+thread_count-1)/thread_count;
isize remaining_count = total_count;
@@ -4754,6 +4762,21 @@ void check_procedure_bodies(Checker *c) {
if (!build_context.threaded_checker) {
worker_count = 0;
}
+ if (worker_count == 0) {
+ auto *this_queue = &c->procs_to_check_queue;
+
+ UntypedExprInfoMap untyped = {};
+ map_init(&untyped, heap_allocator());
+
+ for (ProcInfo *pi = nullptr; mpmc_dequeue(this_queue, &pi); /**/) {
+ consume_proc_info_queue(c, pi, this_queue, &untyped);
+ }
+
+ map_destroy(&untyped);
+
+ debugf("Total Procedure Bodies Checked: %td\n", total_bodies_checked.load(std::memory_order_relaxed));
+ return;
+ }
global_procedure_body_in_worker_queue = true;