blob: 73655d08f089b630c2dcc515fe1b45de39486975 (
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
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef POOL_H
#define POOL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
typedef void *(*worker_func)(void *);
struct pool_task_t {
worker_func func;
void* arg;
int done;
};
struct pool_t {
int workers;
struct pool_task_t* tasks;
struct pool_task_t* task_next;
size_t pool_size;
int* condition;
};
struct pool_t* pool_init();
void pool_free(struct pool_t*);
void pool_submit(struct pool_t*, worker_func, void*);
void pool_complete(struct pool_t*);
#ifdef __cplusplus
}
#endif
#endif
|