summaryrefslogtreecommitdiff
path: root/src/threadpool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/threadpool.h')
-rw-r--r--src/threadpool.h30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/threadpool.h b/src/threadpool.h
index 3048eea..7fda6f5 100644
--- a/src/threadpool.h
+++ b/src/threadpool.h
@@ -4,33 +4,9 @@
4#include "shared.h" 4#include "shared.h"
5#include <threads.h> 5#include <threads.h>
6 6
7typedef struct task { 7typedef struct task task;
8 gcallback callback; 8typedef struct taskqueue taskqueue;
9 fcallback freecb; 9typedef struct ctqueue ctqueue;
10 void *data;
11} task;
12
13typedef struct tqnode {
14 struct tqnode *next;
15 struct tqnode *prev;
16 task *task;
17} tqnode;
18
19typedef struct taskqueue {
20 tqnode *start;
21 tqnode *end;
22 unsigned int size;
23} taskqueue;
24
25typedef struct ctqueue {
26 mtx_t mutex;
27 cnd_t cond;
28 unsigned char canceled;
29
30 taskqueue *tq;
31 thrd_t *thrdarr;
32 int talen;
33} ctqueue;
34 10
35// Create a new task. Sets `errno` and returns `NULL` on error 11// Create a new task. Sets `errno` and returns `NULL` on error
36task * task_init(gcallback callback, fcallback freecb, void *data); 12task * task_init(gcallback callback, fcallback freecb, void *data);