[Top][All Lists]
[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
- [Qemu-devel] [RFC][PATCH 00/12] qcow2: Convert qcow2 to use coroutines for async I/O, Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 07/12] coroutine: Add coroutine_is_leader(),
Stefan Hajnoczi <=
- [Qemu-devel] [RFC][PATCH 08/12] coroutine: Add qemu_in_coroutine(), Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 04/12] coroutine: Use thread-local leader and current variables, Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 09/12] block: Add bdrv_co_readv() and bdrv_co_writev(), Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 10/12] block: Add coroutine support to synchronous I/O functions, Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 06/12] coroutine: Add qemu_coroutine_self(), Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 12/12] qcow2: Serialize all requests, Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 05/12] coroutine: Add coroutines, Stefan Hajnoczi, 2011/01/22