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>
/* Run dispatch even if there were no readable fds to run timers */
aio_set_dispatching(ctx, true);
+ if (aio_bh_poll(ctx)) {
+ progress = true;
+ }
+
if (aio_dispatch(ctx)) {
progress = true;
}
{
AioHandler *node;
HANDLE events[MAXIMUM_WAIT_OBJECTS + 1];
- bool progress;
+ bool progress, first;
int count;
int timeout;
}
ctx->walking_handlers--;
+ first = true;
/* wait until next event */
while (count > 0) {
? 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;