qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC][PATCH 07/12] coroutine: Add coroutine_is_leader()


From: Stefan Hajnoczi
Subject: [Qemu-devel] [RFC][PATCH 07/12] coroutine: Add coroutine_is_leader()
Date: Sat, 22 Jan 2011 09:29:22 +0000

Make it possible to check whether a coroutine is the default main
coroutine (the "leader") or not.

Signed-off-by: Stefan Hajnoczi <address@hidden>
---
 coroutine.h          |    2 ++
 coroutine_ucontext.c |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/coroutine.h b/coroutine.h
index 5316535..3aca19a 100644
--- a/coroutine.h
+++ b/coroutine.h
@@ -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);
diff --git a/coroutine_ucontext.c b/coroutine_ucontext.c
index 289e5bd..b90a2f6 100644
--- a/coroutine_ucontext.c
+++ b/coroutine_ucontext.c
@@ -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;
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]