aboutsummaryrefslogtreecommitdiff
path: root/tpool.h
diff options
context:
space:
mode:
Diffstat (limited to 'tpool.h')
-rw-r--r--tpool.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/tpool.h b/tpool.h
new file mode 100644
index 0000000..e1079ef
--- /dev/null
+++ b/tpool.h
@@ -0,0 +1,20 @@
+#include <stdbool.h>
+#include <stdlib.h>
+
+#ifndef __TPOOL_H
+#define __TPOOL_H
+
+struct tpool;
+typedef struct tpool tpool_t;
+
+extern tpool_t *tpool;
+
+typedef void (*thread_func_t)(void *arg);
+
+tpool_t *tpool_create(size_t num);
+void tpool_destroy(tpool_t *tp);
+
+bool tpool_add_work(tpool_t *tp, thread_func_t func, void *arg);
+void tpool_wait(tpool_t *tp);
+
+#endif