summaryrefslogtreecommitdiff
path: root/qemu-coroutine-lock.c
diff options
context:
space:
mode:
authorZhi Yong Wu <wuzhy@linux.vnet.ibm.com>2011-11-03 16:57:26 +0800
committerKevin Wolf <kwolf@redhat.com>2011-12-05 14:51:35 +0100
commite9e6295b28b331762e67d466f77ba07a349edbbc (patch)
tree8975b826cbd4014d7e1ca392034d117c988524c0 /qemu-coroutine-lock.c
parent0563e191516289c9d2f282a8c50f2eecef2fa773 (diff)
downloadqemu-e9e6295b28b331762e67d466f77ba07a349edbbc.tar.gz
CoQueue: introduce qemu_co_queue_wait_insert_head
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-coroutine-lock.c')
-rw-r--r--qemu-coroutine-lock.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c
index 6b58160058..9549c075ee 100644
--- a/qemu-coroutine-lock.c
+++ b/qemu-coroutine-lock.c
@@ -61,6 +61,14 @@ void coroutine_fn qemu_co_queue_wait(CoQueue *queue)
assert(qemu_in_coroutine());
}
+void coroutine_fn qemu_co_queue_wait_insert_head(CoQueue *queue)
+{
+ Coroutine *self = qemu_coroutine_self();
+ QTAILQ_INSERT_HEAD(&queue->entries, self, co_queue_next);
+ qemu_coroutine_yield();
+ assert(qemu_in_coroutine());
+}
+
bool qemu_co_queue_next(CoQueue *queue)
{
Coroutine *next;