]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
CoQueue: introduce qemu_co_queue_wait_insert_head
authorZhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Thu, 3 Nov 2011 08:57:26 +0000 (16:57 +0800)
committerKevin Wolf <kwolf@redhat.com>
Mon, 5 Dec 2011 13:51:35 +0000 (14:51 +0100)
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>
qemu-coroutine-lock.c
qemu-coroutine.h

index 6b58160058c26737786248854bde9c8edaa5d9d1..9549c075ee7de3ebdef701c2f603a96516a36911 100644 (file)
@@ -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;
index b8fc4f43328c0b5e482bd425888d7c2a599b1e35..8a2e5d2a105a7bc2b3c5e06485868e2d8b699cab 100644 (file)
@@ -117,6 +117,12 @@ void qemu_co_queue_init(CoQueue *queue);
  */
 void coroutine_fn qemu_co_queue_wait(CoQueue *queue);
 
+/**
+ * Adds the current coroutine to the head of the CoQueue and transfers control to the
+ * caller of the coroutine.
+ */
+void coroutine_fn qemu_co_queue_wait_insert_head(CoQueue *queue);
+
 /**
  * Restarts the next coroutine in the CoQueue and removes it from the queue.
  *