#ifndef __VXGG_REWRITE___THREADPOOL_H___13601325413136___ #define __VXGG_REWRITE___THREADPOOL_H___13601325413136___ #include typedef int (*task_callback)(void*); typedef struct task task; typedef struct cq cqueue; typedef struct tp threadpool; task * task_init(task_callback cb, void *arg); void task_free(task *ts); cqueue * cqueue_init(int mtx_type); void cqueue_free(cqueue *cq); int cqueue_append(cqueue * const cq, task *tsk); int cqueue_prepend(cqueue * const cq, task *tsk); int cqueue_insert(cqueue * const cq, task *tsk, int index); int cqueue_size(cqueue const * const cq); int cqueue_isempty(cqueue const * const cq); int cqueue_trypop(cqueue * const cq, task **ret); int cqueue_waitpop(cqueue * const cq, task **ret); int cqueue_cancel(cqueue * const cq); typedef struct mtxp mtxpair; mtxpair * mtxpair_init(void * const data, int type); void mtxpair_free(mtxpair *mp); int mtxpair_setdata(mtxpair * const mp, void * const data); int thrd_createwmx(thrd_t * const thr, thrd_start_t func, mtxpair * const mtxd); int cqueue_cancel(cqueue * const cq); #endif