From bfdcf900ef25566e57e46ec46683f8b6f2a9515a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 2 Jan 2023 00:56:06 +0000 Subject: [PATCH] Remove `global_` prefix from `global_thread_pool_*` procedures --- src/checker.cpp | 12 ++++++------ src/llvm_backend.cpp | 2 +- src/main.cpp | 4 ++-- src/parser.cpp | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/checker.cpp b/src/checker.cpp index e70643940..a25d78d3d 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -4654,9 +4654,9 @@ gb_internal void check_with_workers(Checker *c, WorkerTaskProc *proc, isize tota for (isize i = 0; i < thread_count; i++) { - global_thread_pool_add_task(proc, thread_data+i); + thread_pool_add_task(proc, thread_data+i); } - global_thread_pool_wait(); + thread_pool_wait(); semaphore_wait(&c->info.collect_semaphore); } @@ -4704,9 +4704,9 @@ gb_internal void check_collect_entities_all(Checker *c) { if (build_context.threaded_checker) { for (auto const &entry : c->info.files.entries) { AstFile *f = entry.value; - global_thread_pool_add_task(check_collect_entities_all_worker_proc, f); + thread_pool_add_task(check_collect_entities_all_worker_proc, f); } - global_thread_pool_wait(); + thread_pool_wait(); } else { for (auto const &entry : c->info.files.entries) { AstFile *f = entry.value; @@ -5350,9 +5350,9 @@ gb_internal void check_procedure_bodies(Checker *c) { semaphore_post(&c->procs_to_check_semaphore, cast(i32)thread_count); for (isize i = 0; i < thread_count; i++) { - global_thread_pool_add_task(thread_proc_body, thread_data+i); + thread_pool_add_task(thread_proc_body, thread_data+i); } - global_thread_pool_wait(); + thread_pool_wait(); semaphore_wait(&c->procs_to_check_semaphore); isize global_remaining = c->procs_to_check_queue.count.load(std::memory_order_relaxed); diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index 146cb2944..1c401552e 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -2272,7 +2272,7 @@ gb_internal void lb_generate_code(lbGenerator *gen) { wd->code_gen_file_type = code_gen_file_type; wd->filepath_obj = filepath_obj; wd->m = m; - global_thread_pool_add_task(lb_llvm_emit_worker_proc, wd); + thread_pool_add_task(lb_llvm_emit_worker_proc, wd); } thread_pool_wait(&global_thread_pool); diff --git a/src/main.cpp b/src/main.cpp index 184ab471e..3ad0e160f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,10 +20,10 @@ gb_internal void init_global_thread_pool(void) { isize worker_count = thread_count-1; // NOTE(bill): The main thread will also be used for work thread_pool_init(&global_thread_pool, permanent_allocator(), worker_count, "ThreadPoolWorker"); } -gb_internal bool global_thread_pool_add_task(WorkerTaskProc *proc, void *data) { +gb_internal bool thread_pool_add_task(WorkerTaskProc *proc, void *data) { return thread_pool_add_task(&global_thread_pool, proc, data); } -gb_internal void global_thread_pool_wait(void) { +gb_internal void thread_pool_wait(void) { thread_pool_wait(&global_thread_pool); } diff --git a/src/parser.cpp b/src/parser.cpp index 4a5ba78a9..4d2a8ecf4 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -4910,7 +4910,7 @@ gb_internal void parser_add_file_to_process(Parser *p, AstPackage *pkg, FileInfo auto wd = gb_alloc_item(permanent_allocator(), ParserWorkerData); wd->parser = p; wd->imported_file = f; - global_thread_pool_add_task(parser_worker_proc, wd); + thread_pool_add_task(parser_worker_proc, wd); } gb_internal WORKER_TASK_PROC(foreign_file_worker_proc) { @@ -4948,7 +4948,7 @@ gb_internal void parser_add_foreign_file_to_process(Parser *p, AstPackage *pkg, wd->parser = p; wd->imported_file = f; wd->foreign_kind = kind; - global_thread_pool_add_task(foreign_file_worker_proc, wd); + thread_pool_add_task(foreign_file_worker_proc, wd); } @@ -5798,7 +5798,7 @@ gb_internal ParseFileError parse_packages(Parser *p, String init_filename) { } } - global_thread_pool_wait(); + thread_pool_wait(); for (ParseFileErrorNode *node = p->file_error_head; node != nullptr; node = node->next) { if (node->err != ParseFile_None) {