static int os_host_main_loop_wait(uint32_t timeout)

{

    int ret;



    glib_select_fill(&nfds, &rfds, &wfds, &xfds, &timeout);



    if (timeout > 0) {

        qemu_mutex_unlock_iothread();

    }



    /* We'll eventually drop fd_set completely.  But for now we still have

     * *_fill() and *_poll() functions that use rfds/wfds/xfds.

     */

    gpollfds_from_select();



    ret = g_poll((GPollFD *)gpollfds->data, gpollfds->len, timeout);



    gpollfds_to_select(ret);



    if (timeout > 0) {

        qemu_mutex_lock_iothread();

    }



    glib_select_poll(&rfds, &wfds, &xfds, (ret < 0));

    return ret;

}

static int os_host_main_loop_wait(uint32_t timeout)

{

    int ret;



    glib_select_fill(&nfds, &rfds, &wfds, &xfds, &timeout);



    if (timeout > 0) {

        qemu_mutex_unlock_iothread();

    }



    





    gpollfds_from_select();



    ret = g_poll((GPollFD *)gpollfds->data, gpollfds->len, timeout);



    gpollfds_to_select(ret);



    if (timeout > 0) {

        qemu_mutex_lock_iothread();

    }



    glib_select_poll(&rfds, &wfds, &xfds, (ret < 0));

    return ret;

}

static int FUNC_0(uint32_t VAR_0)

{

    int VAR_1;



    glib_select_fill(&nfds, &rfds, &wfds, &xfds, &VAR_0);



    if (VAR_0 > 0) {

        qemu_mutex_unlock_iothread();

    }



    





    gpollfds_from_select();



    VAR_1 = g_poll((GPollFD *)gpollfds->data, gpollfds->len, VAR_0);



    gpollfds_to_select(VAR_1);



    if (VAR_0 > 0) {

        qemu_mutex_lock_iothread();

    }



    glib_select_poll(&rfds, &wfds, &xfds, (VAR_1 < 0));

    return VAR_1;

}

static int FUNC_0(uint32_t VAR_0)
{ int VAR_1; glib_select_fill(&nfds, &rfds, &wfds, &xfds, &VAR_0); if (VAR_0 > 0) { qemu_mutex_unlock_iothread(); } gpollfds_from_select(); VAR_1 = g_poll((GPollFD *)gpollfds->data, gpollfds->len, VAR_0); gpollfds_to_select(VAR_1); if (VAR_0 > 0) { qemu_mutex_lock_iothread(); } glib_select_poll(&rfds, &wfds, &xfds, (VAR_1 < 0)); return VAR_1; }