diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:22:16 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:22:16 +0100 |
| commit | c7ab12bba64d9c20ccd79b132dac475f7bc3923e (patch) | |
| tree | abf2891f9bd1bfa549ed460b288e2c19348bc230 /tpool.h | |
| parent | 2b3d92e401f0065e440b51da9a6532695b37ef84 (diff) | |
| download | crep-c7ab12bba64d9c20ccd79b132dac475f7bc3923e.tar.gz | |
Re-enable multi-threading
Diffstat (limited to 'tpool.h')
| -rw-r--r-- | tpool.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -0,0 +1,21 @@ +#ifndef THREAD_POOL_H +#define THREAD_POOL_H + +#include <pthread.h> +#include <stdbool.h> + +typedef void (*thread_func_t)(void *arg); + +typedef struct { + thread_func_t function; + void *arg; +} ThreadPoolJob; + +typedef struct ThreadPool ThreadPool; + +ThreadPool *tp_create(int num_threads); +void tp_add_job(ThreadPool *pool, thread_func_t function, void *arg); +void tp_wait(ThreadPool *pool); +void tp_destroy(ThreadPool *pool); + +#endif |
