aio: simplify qemu_aio_wait

The do...while loop can never loop, because select will just not return
0 when invoked with infinite timeout.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Paolo Bonzini 2012-04-12 14:00:56 +02:00 committed by Kevin Wolf
parent bcdc18578d
commit 9eb0bfca96

13
aio.c
View file

@ -104,7 +104,11 @@ void qemu_aio_flush(void)
bool qemu_aio_wait(void)
{
AioHandler *node;
fd_set rdfds, wrfds;
int max_fd = -1;
int ret;
bool busy;
/*
* If there are callbacks left that have been queued, we need to call then.
@ -115,12 +119,6 @@ bool qemu_aio_wait(void)
return true;
}
do {
AioHandler *node;
fd_set rdfds, wrfds;
bool busy;
int max_fd = -1;
walking_handlers = 1;
FD_ZERO(&rdfds);
@ -158,8 +156,6 @@ bool qemu_aio_wait(void)
/* wait until next event */
ret = select(max_fd, &rdfds, &wrfds, NULL, NULL);
if (ret == -1 && errno == EINTR)
continue;
/* if we have any readable fds, dispatch event */
if (ret > 0) {
@ -193,7 +189,6 @@ bool qemu_aio_wait(void)
walking_handlers = 0;
}
} while (ret == 0);
return true;
}