virtio-9p: use QEMU thread pool
[qemu.git] / hw / 9pfs / virtio-9p-coth.c
blobfb6e8f80e0f4c6a00b0ad35da3dfb435561444fe
1 /*
2 * Virtio 9p backend
4 * Copyright IBM, Corp. 2010
6 * Authors:
7 * Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
8 * Venkateswararao Jujjuri(JV) <jvrao@linux.vnet.ibm.com>
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
15 #include "qemu-common.h"
16 #include "block/thread-pool.h"
17 #include "qemu/coroutine.h"
18 #include "qemu/main-loop.h"
19 #include "virtio-9p-coth.h"
21 /* Called from QEMU I/O thread. */
22 static void coroutine_enter_cb(void *opaque, int ret)
24 Coroutine *co = opaque;
25 qemu_coroutine_enter(co, NULL);
28 /* Called from worker thread. */
29 static int coroutine_enter_func(void *arg)
31 Coroutine *co = arg;
32 qemu_coroutine_enter(co, NULL);
33 return 0;
36 void co_run_in_worker_bh(void *opaque)
38 Coroutine *co = opaque;
39 thread_pool_submit_aio(qemu_get_aio_context()->thread_pool,
40 coroutine_enter_func, co, coroutine_enter_cb, co);