root / qemu-coroutine-int.h @ 463ce4ae
History | View | Annotate | Download (1.7 kB)
1 | 00dccaf1 | Kevin Wolf | /*
|
---|---|---|---|
2 | 00dccaf1 | Kevin Wolf | * Coroutine internals
|
3 | 00dccaf1 | Kevin Wolf | *
|
4 | 00dccaf1 | Kevin Wolf | * Copyright (c) 2011 Kevin Wolf <kwolf@redhat.com>
|
5 | 00dccaf1 | Kevin Wolf | *
|
6 | 00dccaf1 | Kevin Wolf | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 00dccaf1 | Kevin Wolf | * of this software and associated documentation files (the "Software"), to deal
|
8 | 00dccaf1 | Kevin Wolf | * in the Software without restriction, including without limitation the rights
|
9 | 00dccaf1 | Kevin Wolf | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 00dccaf1 | Kevin Wolf | * copies of the Software, and to permit persons to whom the Software is
|
11 | 00dccaf1 | Kevin Wolf | * furnished to do so, subject to the following conditions:
|
12 | 00dccaf1 | Kevin Wolf | *
|
13 | 00dccaf1 | Kevin Wolf | * The above copyright notice and this permission notice shall be included in
|
14 | 00dccaf1 | Kevin Wolf | * all copies or substantial portions of the Software.
|
15 | 00dccaf1 | Kevin Wolf | *
|
16 | 00dccaf1 | Kevin Wolf | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 00dccaf1 | Kevin Wolf | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 00dccaf1 | Kevin Wolf | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 00dccaf1 | Kevin Wolf | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 00dccaf1 | Kevin Wolf | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 00dccaf1 | Kevin Wolf | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 00dccaf1 | Kevin Wolf | * THE SOFTWARE.
|
23 | 00dccaf1 | Kevin Wolf | */
|
24 | 00dccaf1 | Kevin Wolf | |
25 | 00dccaf1 | Kevin Wolf | #ifndef QEMU_COROUTINE_INT_H
|
26 | 00dccaf1 | Kevin Wolf | #define QEMU_COROUTINE_INT_H
|
27 | 00dccaf1 | Kevin Wolf | |
28 | 00dccaf1 | Kevin Wolf | #include "qemu-queue.h" |
29 | 00dccaf1 | Kevin Wolf | #include "qemu-coroutine.h" |
30 | 00dccaf1 | Kevin Wolf | |
31 | 00dccaf1 | Kevin Wolf | typedef enum { |
32 | 00dccaf1 | Kevin Wolf | COROUTINE_YIELD = 1,
|
33 | 00dccaf1 | Kevin Wolf | COROUTINE_TERMINATE = 2,
|
34 | 00dccaf1 | Kevin Wolf | } CoroutineAction; |
35 | 00dccaf1 | Kevin Wolf | |
36 | 00dccaf1 | Kevin Wolf | struct Coroutine {
|
37 | 00dccaf1 | Kevin Wolf | CoroutineEntry *entry; |
38 | 00dccaf1 | Kevin Wolf | void *entry_arg;
|
39 | 00dccaf1 | Kevin Wolf | Coroutine *caller; |
40 | 00dccaf1 | Kevin Wolf | QLIST_ENTRY(Coroutine) pool_next; |
41 | b96e9247 | Kevin Wolf | QTAILQ_ENTRY(Coroutine) co_queue_next; |
42 | 00dccaf1 | Kevin Wolf | }; |
43 | 00dccaf1 | Kevin Wolf | |
44 | 00dccaf1 | Kevin Wolf | Coroutine *qemu_coroutine_new(void);
|
45 | 00dccaf1 | Kevin Wolf | void qemu_coroutine_delete(Coroutine *co);
|
46 | 00dccaf1 | Kevin Wolf | CoroutineAction qemu_coroutine_switch(Coroutine *from, Coroutine *to, |
47 | 00dccaf1 | Kevin Wolf | CoroutineAction action); |
48 | 00dccaf1 | Kevin Wolf | |
49 | 00dccaf1 | Kevin Wolf | #endif |