summaryrefslogtreecommitdiff
path: root/src/threadpool.h
blob: bd1b7873f86fcc7f7a172fdde78229ddacb9eca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef __VXGG_REWRITE___THREADPOOL_H___13601325413136___
#define __VXGG_REWRITE___THREADPOOL_H___13601325413136___

#include <threads.h>

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);
int task_fire(task *ts);

cqueue * cqueue_init(int mtx_type);

void cqueue_cancel(cqueue *cq);
void cqueue_free(cqueue *cq);
int cqueue_addtask(cqueue * const cq, task * const tsk);
task * cqueue_waitpop(cqueue * const cq);

#endif