blob: 9147cc2c9dc7137bb03a48d1706693f4fddcb22d [file] [log] [blame]
Jens Axboe38a812d2014-07-03 09:10:39 -06001#ifndef FIO_TP_H
2#define FIO_TP_H
3
Jens Axboe65f93ca2014-07-03 14:16:25 -06004#include "../flist.h"
Jens Axboe38a812d2014-07-03 09:10:39 -06005
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;
Jens Axboec9a5f392014-07-09 09:52:20 +020013 int prio;
Jens Axboe38a812d2014-07-03 09:10:39 -060014 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