replaced /RAD_IDLE_WORKERS with /RAD_SHARED_THREAD_POOL_MAX_WORKERS

This commit is contained in:
Nikita Smith
2025-01-24 12:49:30 -08:00
parent 8196ef0a6e
commit f2f18b9798
5 changed files with 90 additions and 69 deletions
+3 -2
View File
@@ -57,7 +57,7 @@ tp_worker_main_shared(void *raw_worker)
}
internal TP_Context *
tp_alloc(Arena *arena, U32 worker_count, String8 name)
tp_alloc(Arena *arena, U32 worker_count, U32 max_worker_count, String8 name)
{
ProfBeginDynamic("Alloc Thread Pool [Worker Count: %u]", worker_count);
AssertAlways(worker_count > 0);
@@ -71,7 +71,8 @@ tp_alloc(Arena *arena, U32 worker_count, String8 name)
if (worker_count > 1) {
main_semaphore = os_semaphore_alloc(0, 1, str8_zero());
if (is_shared) {
task_semaphore = os_semaphore_alloc(0, worker_count, name);
AssertAlways(worker_count <= max_worker_count);
task_semaphore = os_semaphore_alloc(0, max_worker_count, name);
exec_semaphore = os_semaphore_alloc(0, worker_count, str8_zero());
} else {
task_semaphore = os_semaphore_alloc(0, worker_count, str8_zero());
+1 -1
View File
@@ -43,7 +43,7 @@ typedef struct TP_Context
S64 task_left;
} TP_Context;
internal TP_Context * tp_alloc(Arena *arena, U32 worker_count, String8 name);
internal TP_Context * tp_alloc(Arena *arena, U32 worker_count, U32 max_worker_count, String8 name);
internal void tp_release(TP_Context *pool);
internal TP_Arena * tp_arena_alloc(TP_Context *pool);
internal void tp_arena_release(TP_Arena **arena_ptr);