summaryrefslogtreecommitdiff
path: root/tpool.h
diff options
context:
space:
mode:
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