Commit | Line | Data |
---|---|---|
a9da8ab2 JA |
1 | #ifndef FIO_RATE_H |
2 | #define FIO_RATE_H | |
3 | ||
4 | #include "flist.h" | |
5 | ||
88271841 JA |
6 | struct workqueue_work { |
7 | struct flist_head list; | |
8 | }; | |
9 | ||
10 | typedef void (workqueue_fn)(struct thread_data *, struct workqueue_work *); | |
a9da8ab2 JA |
11 | |
12 | struct workqueue { | |
13 | unsigned int max_workers; | |
14 | ||
15 | struct thread_data *td; | |
16 | workqueue_fn *fn; | |
17 | ||
18 | uint64_t work_seq; | |
19 | struct submit_worker *workers; | |
20 | unsigned int next_free_worker; | |
21 | ||
22 | pthread_cond_t flush_cond; | |
23 | pthread_mutex_t flush_lock; | |
2a274336 | 24 | pthread_mutex_t stat_lock; |
a9da8ab2 JA |
25 | volatile int wake_idle; |
26 | }; | |
27 | ||
28 | int workqueue_init(struct thread_data *td, struct workqueue *wq, workqueue_fn *fn, unsigned int max_workers); | |
29 | void workqueue_exit(struct workqueue *wq); | |
30 | ||
88271841 | 31 | bool workqueue_enqueue(struct workqueue *wq, struct workqueue_work *work); |
a9da8ab2 JA |
32 | void workqueue_flush(struct workqueue *wq); |
33 | ||
34 | #endif |