]> git.proxmox.com Git - qemu.git/blobdiff - qemu-coroutine-lock.c
CoQueue: introduce qemu_co_queue_wait_insert_head
[qemu.git] / qemu-coroutine-lock.c
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;