• Paolo Bonzini's avatar
    main-loop: interrupt wait when data arrives on a socket · d3385eb4
    Paolo Bonzini authored
    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: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarBlue Swirl <blauwirbel@gmail.com>
main-loop.h 13.6 KB