summaryrefslogtreecommitdiff
path: root/qemu-coroutine.h
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-01-18 14:40:40 +0000
committerKevin Wolf <kwolf@redhat.com>2012-01-26 11:45:26 +0100
commit7e6246670add62116729bd93811e41eb60f66b77 (patch)
tree725e2f597f9c646f12517256bb6852bb3c51f69e /qemu-coroutine.h
parent031380d8770d2df6c386e4aeabd412007d3ebd54 (diff)
coroutine: add co_sleep_ns() coroutine sleep function
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-coroutine.h')
-rw-r--r--qemu-coroutine.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/qemu-coroutine.h b/qemu-coroutine.h
index 8a55fe125..34c15d411 100644
--- a/qemu-coroutine.h
+++ b/qemu-coroutine.h
@@ -17,6 +17,7 @@
#include <stdbool.h>
#include "qemu-queue.h"
+#include "qemu-timer.h"
/**
* Coroutines are a mechanism for stack switching and can be used for
@@ -199,4 +200,12 @@ void qemu_co_rwlock_wrlock(CoRwlock *lock);
*/
void qemu_co_rwlock_unlock(CoRwlock *lock);
+/**
+ * Yield the coroutine for a given duration
+ *
+ * Note this function uses timers and hence only works when a main loop is in
+ * use. See main-loop.h and do not use from qemu-tool programs.
+ */
+void coroutine_fn co_sleep_ns(QEMUClock *clock, int64_t ns);
+
#endif /* QEMU_COROUTINE_H */