summary refs log tree commit diff stats
path: root/qemu-coroutine-sleep.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2015-09-01 14:48:02 +0100
committerDaniel P. Berrange <berrange@redhat.com>2015-10-20 14:59:04 +0100
commit10817bf09d5f8cb22711fb0ee8d8da49f6f05f89 (patch)
tree735f6b70cedecd57843b9108cb68e2359e147e0c /qemu-coroutine-sleep.c
parent57cb38b3833c5215131b983f181b26d6ba9b8d35 (diff)
downloadfocaccia-qemu-10817bf09d5f8cb22711fb0ee8d8da49f6f05f89.tar.gz
focaccia-qemu-10817bf09d5f8cb22711fb0ee8d8da49f6f05f89.zip
coroutine: move into libqemuutil.a library
The coroutine files are currently referenced by the block-obj-y
variable. The coroutine functionality though is already used by
more than just the block code. eg migration code uses coroutine
yield. In the future the I/O channel code will also use the
coroutine yield functionality. Since the coroutine code is nicely
self-contained it can be easily built as part of the libqemuutil.a
library, making it widely available.

The headers are also moved into include/qemu, instead of the
include/block directory, since they are now part of the util
codebase, and the impl was never in the block/ directory
either.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'qemu-coroutine-sleep.c')
-rw-r--r--qemu-coroutine-sleep.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/qemu-coroutine-sleep.c b/qemu-coroutine-sleep.c
deleted file mode 100644
index 9abb7fdf31..0000000000
--- a/qemu-coroutine-sleep.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * QEMU coroutine sleep
- *
- * Copyright IBM, Corp. 2011
- *
- * Authors:
- *  Stefan Hajnoczi    <stefanha@linux.vnet.ibm.com>
- *
- * This work is licensed under the terms of the GNU LGPL, version 2 or later.
- * See the COPYING.LIB file in the top-level directory.
- *
- */
-
-#include "block/coroutine.h"
-#include "qemu/timer.h"
-#include "block/aio.h"
-
-typedef struct CoSleepCB {
-    QEMUTimer *ts;
-    Coroutine *co;
-} CoSleepCB;
-
-static void co_sleep_cb(void *opaque)
-{
-    CoSleepCB *sleep_cb = opaque;
-
-    qemu_coroutine_enter(sleep_cb->co, NULL);
-}
-
-void coroutine_fn co_aio_sleep_ns(AioContext *ctx, QEMUClockType type,
-                                  int64_t ns)
-{
-    CoSleepCB sleep_cb = {
-        .co = qemu_coroutine_self(),
-    };
-    sleep_cb.ts = aio_timer_new(ctx, type, SCALE_NS, co_sleep_cb, &sleep_cb);
-    timer_mod(sleep_cb.ts, qemu_clock_get_ns(type) + ns);
-    qemu_coroutine_yield();
-    timer_del(sleep_cb.ts);
-    timer_free(sleep_cb.ts);
-}