File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,19 @@ Coroutine *coroutine_fn qemu_coroutine_self(void);
92
92
*/
93
93
bool qemu_in_coroutine (void );
94
94
95
+ /**
96
+ * Return true if the coroutine is currently entered
97
+ *
98
+ * A coroutine is "entered" if it has not yielded from the current
99
+ * qemu_coroutine_enter() call used to run it. This does not mean that the
100
+ * coroutine is currently executing code since it may have transferred control
101
+ * to another coroutine using qemu_coroutine_enter().
102
+ *
103
+ * When several coroutines enter each other there may be no way to know which
104
+ * ones have already been entered. In such situations this function can be
105
+ * used to avoid recursively entering coroutines.
106
+ */
107
+ bool qemu_coroutine_entered (Coroutine * co );
95
108
96
109
97
110
/**
Original file line number Diff line number Diff line change @@ -146,3 +146,8 @@ void coroutine_fn qemu_coroutine_yield(void)
146
146
self -> caller = NULL ;
147
147
qemu_coroutine_switch (self , to , COROUTINE_YIELD );
148
148
}
149
+
150
+ bool qemu_coroutine_entered (Coroutine * co )
151
+ {
152
+ return co -> caller ;
153
+ }
You can’t perform that action at this time.
0 commit comments