]> git.proxmox.com Git - mirror_qemu.git/blobdiff - include/block/thread-pool.h
block: Fix deadlocks in bdrv_graph_wrunlock()
[mirror_qemu.git] / include / block / thread-pool.h
index 200703e35f8f1f7f000d43c51ec0bc7f898f6720..948ff5f30c31de452361578dec9fa252817b4a69 100644 (file)
  */
 
 #ifndef QEMU_THREAD_POOL_H
-#define QEMU_THREAD_POOL_H 1
+#define QEMU_THREAD_POOL_H
 
-#include "qemu-common.h"
-#include "qemu/queue.h"
-#include "qemu/thread.h"
-#include "block/coroutine.h"
-#include "block/block_int.h"
+#include "block/aio.h"
+
+#define THREAD_POOL_MAX_THREADS_DEFAULT         64
 
 typedef int ThreadPoolFunc(void *opaque);
 
-BlockDriverAIOCB *thread_pool_submit_aio(ThreadPoolFunc *func, void *arg,
-     BlockDriverCompletionFunc *cb, void *opaque);
+typedef struct ThreadPool ThreadPool;
+
+ThreadPool *thread_pool_new(struct AioContext *ctx);
+void thread_pool_free(ThreadPool *pool);
+
+/*
+ * thread_pool_submit* API: submit I/O requests in the thread's
+ * current AioContext.
+ */
+BlockAIOCB *thread_pool_submit_aio(ThreadPoolFunc *func, void *arg,
+                                   BlockCompletionFunc *cb, void *opaque);
 int coroutine_fn thread_pool_submit_co(ThreadPoolFunc *func, void *arg);
 void thread_pool_submit(ThreadPoolFunc *func, void *arg);
 
+void thread_pool_update_params(ThreadPool *pool, struct AioContext *ctx);
+
 #endif