The timeout argument was unused up to now,
but it can be used to reduce the poll_timeout when it is infinite
(negative value) or larger than timeout.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
if (nfds >= 0) {
ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0);
if (ret != 0) {
- /* TODO. */
+ timeout = 0;
}
}
poll_fds[n_poll_fds + i].events = G_IO_IN;
}
+ if (poll_timeout < 0 || timeout < poll_timeout) {
+ poll_timeout = timeout;
+ }
+
qemu_mutex_unlock_iothread();
ret = g_poll(poll_fds, n_poll_fds + w->num, poll_timeout);
qemu_mutex_lock_iothread();