summaryrefslogtreecommitdiff
path: root/src/threadpool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/threadpool.h')
-rw-r--r--src/threadpool.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/threadpool.h b/src/threadpool.h
index 8e3ee41..c28f03a 100644
--- a/src/threadpool.h
+++ b/src/threadpool.h
@@ -3,6 +3,25 @@
3 3
4#include <threads.h> 4#include <threads.h>
5 5
6typedef int (*task_callback)(void*);
7typedef struct task task;
8typedef struct cq cqueue;
9typedef struct tp threadpool;
10
11task * task_init(task_callback cb, void *arg);
12void task_free(task *ts);
13
14cqueue * cqueue_init(int mtx_type);
15void cqueue_free(cqueue *cq);
16int cqueue_append(cqueue * const cq, task *tsk);
17int cqueue_prepend(cqueue * const cq, task *tsk);
18int cqueue_insert(cqueue * const cq, task *tsk, int index);
19int cqueue_size(cqueue const * const cq);
20int cqueue_isempty(cqueue const * const cq);
21int cqueue_trypop(cqueue * const cq, task **ret);
22int cqueue_waitpop(cqueue * const cq, task **ret);
23int cqueue_cancel(cqueue * const cq);
24
6typedef struct mtxp mtxpair; 25typedef struct mtxp mtxpair;
7mtxpair * mtxpair_init(void * const data, int type); 26mtxpair * mtxpair_init(void * const data, int type);
8void mtxpair_free(mtxpair *mp); 27void mtxpair_free(mtxpair *mp);
@@ -10,4 +29,6 @@ int mtxpair_setdata(mtxpair * const mp, void * const data);
10 29
11int thrd_createwmx(thrd_t * const thr, thrd_start_t func, mtxpair * const mtxd); 30int thrd_createwmx(thrd_t * const thr, thrd_start_t func, mtxpair * const mtxd);
12 31
32int cqueue_cancel(cqueue * const cq);
33
13#endif \ No newline at end of file 34#endif \ No newline at end of file