[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/41] CoQueue: introduce qemu_co_queue_wait_insert_
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 07/41] CoQueue: introduce qemu_co_queue_wait_insert_head |
Date: |
Mon, 5 Dec 2011 15:20:44 +0100 |
From: Zhi Yong Wu <address@hidden>
Signed-off-by: Zhi Yong Wu <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-coroutine-lock.c | 8 ++++++++
qemu-coroutine.h | 6 ++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c
index 6b58160..9549c07 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;
diff --git a/qemu-coroutine.h b/qemu-coroutine.h
index b8fc4f4..8a2e5d2 100644
--- a/qemu-coroutine.h
+++ b/qemu-coroutine.h
@@ -118,6 +118,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.
*
* Returns true if a coroutine was restarted, false if the queue is empty.
--
1.7.6.4
- [Qemu-devel] [PULL 00/41] Block patches, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 01/41] qcow2: Unlock during COW, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 08/41] block: add I/O throttling algorithm, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 07/41] CoQueue: introduce qemu_co_queue_wait_insert_head,
Kevin Wolf <=
- [Qemu-devel] [PATCH 05/41] block: Use bdrv functions to replace file operation in cow.c, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 04/41] xen_disk: remove dead code, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 06/41] block: add the blockio limits command line support, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 02/41] qcow2: avoid reentrant bdrv_read() in copy_sectors(), Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 03/41] qed: adjust the way to get nb_sectors, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 13/41] qcow2: Update snapshot table information at once, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 15/41] qcow2: Rework qcow2_snapshot_create error handling, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 10/41] block: Add coroutine_fn marker to coroutine functions, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 09/41] hmp/qmp: add block_set_io_throttle, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 12/41] qcow2: Return real error code in qcow2_write_snapshots, Kevin Wolf, 2011/12/05