workqueue: add a workqueue_work type
[fio.git] / workqueue.h
index 5d47a5e64fdd908698e1909e06446b7fecbafa91..26b3aee1602171e9b090363c275003a53b13791a 100644 (file)
@@ -3,7 +3,11 @@
 
 #include "flist.h"
 
-typedef void (workqueue_fn)(struct thread_data *, struct io_u *);
+struct workqueue_work {
+       struct flist_head list;
+};
+
+typedef void (workqueue_fn)(struct thread_data *, struct workqueue_work *);
 
 struct workqueue {
        unsigned int max_workers;
@@ -17,13 +21,14 @@ struct workqueue {
 
        pthread_cond_t flush_cond;
        pthread_mutex_t flush_lock;
+       pthread_mutex_t stat_lock;
        volatile int wake_idle;
 };
 
 int workqueue_init(struct thread_data *td, struct workqueue *wq, workqueue_fn *fn, unsigned int max_workers);
 void workqueue_exit(struct workqueue *wq);
 
-int workqueue_enqueue(struct workqueue *wq, struct io_u *io_u);
+bool workqueue_enqueue(struct workqueue *wq, struct workqueue_work *work);
 void workqueue_flush(struct workqueue *wq);
 
 #endif