diff options
| author | steven-na <noreply.github@stvnc.dev> | 2026-08-14 16:31:44 -0700 |
|---|---|---|
| committer | steven-na <noreply.github@stvnc.dev> | 2026-08-14 16:31:44 -0700 |
| commit | f10afce9821a81c8dd138b84a4f1ab56116af20b (patch) | |
| tree | 0233ed16ced2a3e36793ff48a2ff5384dcacf74f /src/threadpool.h | |
| parent | d3e8a2361f78ef505c8cae2e30faefbfae5c88e1 (diff) | |
Add log messages, can be disabled. Made return values more consistent
Diffstat (limited to 'src/threadpool.h')
| -rw-r--r-- | src/threadpool.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/threadpool.h b/src/threadpool.h index ae97583..b009008 100644 --- a/src/threadpool.h +++ b/src/threadpool.h @@ -5,22 +5,23 @@ #include "smrt_arena.h" #include <bits/pthreadtypes.h> -#include <semaphore.h> typedef void (*tp_job_proc)(void *args); typedef struct { u64 num_threads; pthread_t * threads; - +// Threads check this before waiting for a job b32 is_running; - +// Write mutex for num_active/alive pthread_mutex_t * count_mtx; +// Signal to tp_wait that all jobs are complete pthread_cond_t *done_signal; - +// Threads currently doing a job u64 num_active; +// Threads who are alive u64 num_alive; - +// Job queue ts_deque_t jobs; } thread_pool_t; @@ -29,7 +30,6 @@ thread_pool_t *tp_create(smrt_arena_t * arena , u64 max_jobs , u64 num_threads); -// This function waits for threads to finish, frees relevant allocations, and then frees *tp. i32 tp_destroy(thread_pool_t *tp); i32 tp_push_job(thread_pool_t * tp , |