From a3462c656128e7b900ccc5d436f9e858d07de264 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 9 Jul 2014 11:53:08 +0200 Subject: 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 Signed-off-by: Stefan Hajnoczi --- async.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'async.c') diff --git a/async.c b/async.c index 293a52a0a7..a99e7f639a 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; } -- cgit v1.2.3