diff options
Diffstat (limited to 'src/threadpool.h')
| -rw-r--r-- | src/threadpool.h | 30 |
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 | ||
| 7 | typedef struct task { | 7 | typedef struct task task; |
| 8 | gcallback callback; | 8 | typedef struct taskqueue taskqueue; |
| 9 | fcallback freecb; | 9 | typedef struct ctqueue ctqueue; |
| 10 | void *data; | ||
| 11 | } task; | ||
| 12 | |||
| 13 | typedef struct tqnode { | ||
| 14 | struct tqnode *next; | ||
| 15 | struct tqnode *prev; | ||
| 16 | task *task; | ||
| 17 | } tqnode; | ||
| 18 | |||
| 19 | typedef struct taskqueue { | ||
| 20 | tqnode *start; | ||
| 21 | tqnode *end; | ||
| 22 | unsigned int size; | ||
| 23 | } taskqueue; | ||
| 24 | |||
| 25 | typedef 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 |
| 36 | task * task_init(gcallback callback, fcallback freecb, void *data); | 12 | task * task_init(gcallback callback, fcallback freecb, void *data); |
