summaryrefslogtreecommitdiff
path: root/src/threadpool.h
blob: d7b713c318f465860aa1ddab3de3b21934ef54e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#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(void *ts);
int task_fire(task *ts);

cqueue * cqueue_init();
void cqueue_cancel(cqueue * const cq);
void cqueue_free(void *cq);
int cqueue_addtask(cqueue * const cq, task * const tsk);
task * cqueue_waitpop(cqueue * const cq);
int cqueue_registerthreads(cqueue * const cq, int threads);
int cqueue_registerthread(cqueue * const cq);
int cqueue_iscanceled(cqueue * const cq);
int cqueue_numthreads(cqueue * const cq);
int cqueue_numtasks(cqueue * const cq);

#endif