@@ -58,6 +58,8 @@ void *coroutine_swap(struct coroutine *from, struct coroutine *to, void *arg);
struct coroutine *coroutine_self(void);
+int coroutine_is_leader(struct coroutine *co);
+
void *coroutine_yieldto(struct coroutine *to, void *arg);
void *coroutine_yield(void *arg);
@@ -80,6 +80,11 @@ struct coroutine *coroutine_self(void)
return current;
}
+int coroutine_is_leader(struct coroutine *co)
+{
+ return co == &leader;
+}
+
void *coroutine_swap(struct coroutine *from, struct coroutine *to, void *arg)
{
int ret;
Make it possible to check whether a coroutine is the default main coroutine (the "leader") or not. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> --- coroutine.h | 2 ++ coroutine_ucontext.c | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-)