summaryrefslogtreecommitdiff
path: root/main-loop.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-03-20 10:49:19 +0100
committerBlue Swirl <blauwirbel@gmail.com>2012-04-07 08:34:16 +0000
commitd3385eb448e38f828c78f8f68ec5d79c66a58b5d (patch)
tree86d8bd988391e96e5b0b835e0af7220a33819b50 /main-loop.h
parent15455536df5ef652759ccf465d5e6f73acb493df (diff)
main-loop: interrupt wait when data arrives on a socket
Right now, the main loop is not interrupted when data arrives on a socket. To fix this, register each socket to interrupt the main loop with WSAEventSelect. This does not replace select, it only communicates a change in socket state that requires a select call. Since the interrupt fires only once per recv call, or only once after a send call returns EWOULDBLOCK we can activate it on all events unconditionally. If QEMU is momentarily uninterested on some condition, the main loop will not busy wait. Instead, it may get one extra wakeup, but then it will ignore the condition until progress occurs and/or qemu_set_fd_handler is called to set a callback. At this point the condition will be tested via select and the callback will be invoked even if it is still disabled on the event. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'main-loop.h')
-rw-r--r--main-loop.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/main-loop.h b/main-loop.h
index 4987041ce7..e743aa0cf6 100644
--- a/main-loop.h
+++ b/main-loop.h
@@ -359,6 +359,7 @@ void qemu_mutex_unlock_iothread(void);
/* internal interfaces */
+void qemu_fd_register(int fd);
void qemu_iohandler_fill(int *pnfds, fd_set *readfds, fd_set *writefds, fd_set *xfds);
void qemu_iohandler_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, int rc);