Skip to content
  • Paolo Bonzini's avatar
    AioContext: export and use aio_dispatch · e4c7e2d1
    Paolo Bonzini authored
    
    
    So far, aio_poll's scheme was dispatch/poll/dispatch, where
    the first dispatch phase was used only in the GSource case in
    order to avoid a blocking poll.  Earlier patches changed it to
    dispatch/prepare/poll/dispatch, where prepare is aio_compute_timeout.
    
    By making aio_dispatch public, we can remove the first dispatch
    phase altogether, so that both aio_poll and the GSource use the same
    prepare/poll/dispatch scheme.
    
    This patch breaks the invariant that aio_poll(..., true) will not block
    the first time it returns false.  This used to be fundamental for
    qemu_aio_flush's implementation as "while (qemu_aio_wait()) {}" but
    no code in QEMU relies on this invariant anymore.  The return value
    of aio_poll() is now comparable with that of g_main_context_iteration.
    
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    e4c7e2d1