]> git.proxmox.com Git - mirror_qemu.git/blame - hw/9pfs/coth.c
thread-pool: avoid passing the pool parameter every time
[mirror_qemu.git] / hw / 9pfs / coth.c
CommitLineData
39c0564e 1/*
fe52840c 2 * 9p backend
39c0564e
VJ
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
8 * Venkateswararao Jujjuri(JV) <jvrao@linux.vnet.ibm.com>
9 *
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
12 *
13 */
14
6f569084
CS
15/*
16 * Not so fast! You might want to read the 9p developer docs first:
17 * https://wiki.qemu.org/Documentation/9p
18 */
19
fbc04127 20#include "qemu/osdep.h"
ebac1202 21#include "block/thread-pool.h"
10817bf0 22#include "qemu/coroutine.h"
db725815 23#include "qemu/main-loop.h"
fe52840c 24#include "coth.h"
39c0564e 25
ebac1202
PB
26/* Called from QEMU I/O thread. */
27static void coroutine_enter_cb(void *opaque, int ret)
39c0564e
VJ
28{
29 Coroutine *co = opaque;
0b8b8753 30 qemu_coroutine_enter(co);
39c0564e
VJ
31}
32
ebac1202
PB
33/* Called from worker thread. */
34static int coroutine_enter_func(void *arg)
39c0564e 35{
ebac1202 36 Coroutine *co = arg;
0b8b8753 37 qemu_coroutine_enter(co);
ebac1202 38 return 0;
39c0564e
VJ
39}
40
ebac1202 41void co_run_in_worker_bh(void *opaque)
39c0564e 42{
ebac1202 43 Coroutine *co = opaque;
aef04fc7 44 thread_pool_submit_aio(coroutine_enter_func, co, coroutine_enter_cb, co);
39c0564e 45}