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