diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-07-09 11:53:04 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-08-29 10:46:58 +0100 |
commit | 3672fa50837c1700deb1f86f0068c22c7e49aa22 (patch) | |
tree | b9988cd1991b5fc542413bd2dac0586396af8908 /aio-win32.c | |
parent | a398dea34c62b238e714bb4c3a968b4ca11e256b (diff) |
AioContext: run bottom halves after polling
Make the dispatching phase the same before blocking and afterwards.
The next patch will make aio_dispatch public and use it directly
for the GSource case, instead of aio_poll. aio_poll can then be
simplified heavily.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'aio-win32.c')
-rw-r--r-- | aio-win32.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/aio-win32.c b/aio-win32.c index 5e37b42530..2ac38a897c 100644 --- a/aio-win32.c +++ b/aio-win32.c @@ -143,7 +143,7 @@ bool aio_poll(AioContext *ctx, bool blocking) { AioHandler *node; HANDLE events[MAXIMUM_WAIT_OBJECTS + 1]; - bool progress; + bool progress, first; int count; int timeout; @@ -177,6 +177,7 @@ bool aio_poll(AioContext *ctx, bool blocking) } ctx->walking_handlers--; + first = true; /* wait until next event */ while (count > 0) { @@ -186,6 +187,11 @@ bool aio_poll(AioContext *ctx, bool blocking) ? qemu_timeout_ns_to_ms(aio_compute_timeout(ctx)) : 0; ret = WaitForMultipleObjects(count, events, FALSE, timeout); + if (first && aio_bh_poll(ctx)) { + progress = true; + } + first = false; + /* if we have any signaled events, dispatch event */ if ((DWORD) (ret - WAIT_OBJECT_0) >= count) { break; |