summaryrefslogtreecommitdiffstats
path: root/qemu-coroutine-lock.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-07-29 11:33:48 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-07-29 11:33:48 -0500
commiteddbf0ab9db8385d7cb57e23891c1d41488b303e (patch)
tree54e875e237c4a0d0f6ee09f3489dd9ceaf5f529b /qemu-coroutine-lock.c
parent4ff1fac4305f78d9cf987ca8abf3bda7f29c856e (diff)
parentb0f2027cde31c645524256763672e09eeb204a9a (diff)
downloadhqemu-eddbf0ab9db8385d7cb57e23891c1d41488b303e.zip
hqemu-eddbf0ab9db8385d7cb57e23891c1d41488b303e.tar.gz
Merge remote-tracking branch 'stefanha/block' into staging
# By Stefan Hajnoczi (4) and others # Via Stefan Hajnoczi * stefanha/block: dataplane: refuse to start if device is already in use dataplane: enable virtio-blk x-data-plane=on live migration migration: fix spice migration migration: notify migration state before starting thread block: Repair the throttling code. gluster: Add image resize support Message-id: 1375112172-24863-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-coroutine-lock.c')
-rw-r--r--qemu-coroutine-lock.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c
index d9fea49..aeb33b9 100644
--- a/qemu-coroutine-lock.c
+++ b/qemu-coroutine-lock.c
@@ -88,16 +88,32 @@ static bool qemu_co_queue_do_restart(CoQueue *queue, bool single)
return true;
}
-bool qemu_co_queue_next(CoQueue *queue)
+bool coroutine_fn qemu_co_queue_next(CoQueue *queue)
{
+ assert(qemu_in_coroutine());
return qemu_co_queue_do_restart(queue, true);
}
-void qemu_co_queue_restart_all(CoQueue *queue)
+void coroutine_fn qemu_co_queue_restart_all(CoQueue *queue)
{
+ assert(qemu_in_coroutine());
qemu_co_queue_do_restart(queue, false);
}
+bool qemu_co_enter_next(CoQueue *queue)
+{
+ Coroutine *next;
+
+ next = QTAILQ_FIRST(&queue->entries);
+ if (!next) {
+ return false;
+ }
+
+ QTAILQ_REMOVE(&queue->entries, next, co_queue_next);
+ qemu_coroutine_enter(next, NULL);
+ return true;
+}
+
bool qemu_co_queue_empty(CoQueue *queue)
{
return (QTAILQ_FIRST(&queue->entries) == NULL);
OpenPOWER on IntegriCloud