summaryrefslogtreecommitdiff
path: root/tpool.h
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:22:16 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:22:16 +0100
commitc7ab12bba64d9c20ccd79b132dac475f7bc3923e (patch)
treeabf2891f9bd1bfa549ed460b288e2c19348bc230 /tpool.h
parent2b3d92e401f0065e440b51da9a6532695b37ef84 (diff)
downloadcrep-c7ab12bba64d9c20ccd79b132dac475f7bc3923e.tar.gz
Re-enable multi-threading
Diffstat (limited to 'tpool.h')
-rw-r--r--tpool.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/tpool.h b/tpool.h
new file mode 100644
index 0000000..d03f70a
--- /dev/null
+++ b/tpool.h
@@ -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