summaryrefslogtreecommitdiffstats
path: root/async.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-07-09 11:53:08 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2014-08-29 10:46:58 +0100
commita3462c656128e7b900ccc5d436f9e858d07de264 (patch)
treef0a5ba8f06d80bbf14fb27466af9d3126b45c4e9 /async.c
parent0a9dd1664a0509f7c3c0c7a5550446258ee70f4b (diff)
downloadhqemu-a3462c656128e7b900ccc5d436f9e858d07de264.zip
hqemu-a3462c656128e7b900ccc5d436f9e858d07de264.tar.gz
AioContext: introduce aio_prepare
This will be used to implement socket polling on Windows. On Windows, select() and g_poll() are completely different; sockets are polled with select() before calling g_poll, and the g_poll must be nonblocking if select() says a socket is ready. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'async.c')
-rw-r--r--async.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/async.c b/async.c
index 293a52a..a99e7f6 100644
--- a/async.c
+++ b/async.c
@@ -188,6 +188,11 @@ aio_ctx_prepare(GSource *source, gint *timeout)
/* We assume there is no timeout already supplied */
*timeout = qemu_timeout_ns_to_ms(aio_compute_timeout(ctx));
+
+ if (aio_prepare(ctx)) {
+ *timeout = 0;
+ }
+
return *timeout == 0;
}
OpenPOWER on IntegriCloud