Merge branch 'patch-1' of git://github.com/Tfindelkind/fio
[fio.git] / workqueue.h
CommitLineData
a9da8ab2
JA
1#ifndef FIO_RATE_H
2#define FIO_RATE_H
3
4#include "flist.h"
5
6typedef void (workqueue_fn)(struct thread_data *, struct io_u *);
7
8struct workqueue {
9 unsigned int max_workers;
10
11 struct thread_data *td;
12 workqueue_fn *fn;
13
14 uint64_t work_seq;
15 struct submit_worker *workers;
16 unsigned int next_free_worker;
17
18 pthread_cond_t flush_cond;
19 pthread_mutex_t flush_lock;
2a274336 20 pthread_mutex_t stat_lock;
a9da8ab2
JA
21 volatile int wake_idle;
22};
23
24int workqueue_init(struct thread_data *td, struct workqueue *wq, workqueue_fn *fn, unsigned int max_workers);
25void workqueue_exit(struct workqueue *wq);
26
27int workqueue_enqueue(struct workqueue *wq, struct io_u *io_u);
28void workqueue_flush(struct workqueue *wq);
29
30#endif