Move tp.[ch] to lib/
[fio.git] / lib / tp.h
1 #ifndef FIO_TP_H
2 #define FIO_TP_H
3
4 #include "../flist.h"
5
6 struct tp_work;
7 typedef int (tp_work_fn)(struct tp_work *);
8
9 struct tp_work {
10         struct flist_head list;
11         tp_work_fn *fn;
12         int wait;
13         pthread_cond_t cv;
14         pthread_mutex_t lock;
15         volatile int done;
16 };
17
18 struct tp_data {
19         pthread_t thread;
20         pthread_cond_t cv;
21         pthread_mutex_t lock;
22         struct flist_head work;
23         volatile int thread_exit;
24         pthread_cond_t sleep_cv;
25         volatile int sleeping;
26 };
27
28 extern void tp_init(struct tp_data **);
29 extern void tp_exit(struct tp_data **);
30 extern void tp_queue_work(struct tp_data *, struct tp_work *);
31
32 #endif