aboutsummaryrefslogtreecommitdiff
path: root/aio-win32.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-02-20 17:26:51 +0100
committerKevin Wolf <kwolf@redhat.com>2015-04-28 15:36:08 +0200
commit49110174f8835ec3d5ca7fc076ee1f51c18564fe (patch)
treec05646cd2b8b3e3ba896ecea96afe5a39118bc2b /aio-win32.c
parente98ab097092e54999f046e9efa1ca1dd52f0c9e5 (diff)
AioContext: acquire/release AioContext during aio_poll
This is the first step in pushing down acquire/release, and will let rfifolock drop the contention callback feature. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1424449612-18215-3-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'aio-win32.c')
-rw-r--r--aio-win32.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/aio-win32.c b/aio-win32.c
index e6f4cedf48..233d8f5d79 100644
--- a/aio-win32.c
+++ b/aio-win32.c
@@ -283,6 +283,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
int count;
int timeout;
+ aio_context_acquire(ctx);
have_select_revents = aio_prepare(ctx);
if (have_select_revents) {
blocking = false;
@@ -323,7 +324,13 @@ bool aio_poll(AioContext *ctx, bool blocking)
timeout = blocking
? qemu_timeout_ns_to_ms(aio_compute_timeout(ctx)) : 0;
+ if (timeout) {
+ aio_context_release(ctx);
+ }
ret = WaitForMultipleObjects(count, events, FALSE, timeout);
+ if (timeout) {
+ aio_context_acquire(ctx);
+ }
aio_set_dispatching(ctx, true);
if (first && aio_bh_poll(ctx)) {
@@ -349,5 +356,6 @@ bool aio_poll(AioContext *ctx, bool blocking)
progress |= timerlistgroup_run_timers(&ctx->tlg);
aio_set_dispatching(ctx, was_dispatching);
+ aio_context_release(ctx);
return progress;
}