]>
Commit | Line | Data |
---|---|---|
39c0564e | 1 | /* |
fe52840c | 2 | * 9p backend |
39c0564e VJ |
3 | * |
4 | * Copyright IBM, Corp. 2010 | |
5 | * | |
6 | * Authors: | |
7 | * Harsh Prateek Bora <[email protected]> | |
8 | * Venkateswararao Jujjuri(JV) <[email protected]> | |
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 | ||
fbc04127 | 15 | #include "qemu/osdep.h" |
ebac1202 | 16 | #include "block/thread-pool.h" |
10817bf0 | 17 | #include "qemu/coroutine.h" |
db725815 | 18 | #include "qemu/main-loop.h" |
fe52840c | 19 | #include "coth.h" |
39c0564e | 20 | |
ebac1202 PB |
21 | /* Called from QEMU I/O thread. */ |
22 | static void coroutine_enter_cb(void *opaque, int ret) | |
39c0564e VJ |
23 | { |
24 | Coroutine *co = opaque; | |
0b8b8753 | 25 | qemu_coroutine_enter(co); |
39c0564e VJ |
26 | } |
27 | ||
ebac1202 PB |
28 | /* Called from worker thread. */ |
29 | static int coroutine_enter_func(void *arg) | |
39c0564e | 30 | { |
ebac1202 | 31 | Coroutine *co = arg; |
0b8b8753 | 32 | qemu_coroutine_enter(co); |
ebac1202 | 33 | return 0; |
39c0564e VJ |
34 | } |
35 | ||
ebac1202 | 36 | void co_run_in_worker_bh(void *opaque) |
39c0564e | 37 | { |
ebac1202 | 38 | Coroutine *co = opaque; |
4b3a4f2d | 39 | thread_pool_submit_aio(aio_get_thread_pool(qemu_get_aio_context()), |
ebac1202 | 40 | coroutine_enter_func, co, coroutine_enter_cb, co); |
39c0564e | 41 | } |