X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=main-loop.c;h=eb3b6e6253694b2c9f62ccbd7ef431fc78afe800;hb=df33219191a8f8ac672f674ec1fd4e1837d760a3;hp=0457bf26f43c279395957f7c1d00487ee3dcbead;hpb=7c7db75576bd5a31508208f153c5aada64b2c8df;p=qemu.git diff --git a/main-loop.c b/main-loop.c index 0457bf26f..eb3b6e625 100644 --- a/main-loop.c +++ b/main-loop.c @@ -410,6 +410,7 @@ static int os_host_main_loop_wait(uint32_t timeout) int ret, i; PollingEntry *pe; WaitObjects *w = &wait_objects; + gint poll_timeout; static struct timeval tv0; /* XXX: need to suppress polling by better using win32 events */ @@ -429,7 +430,7 @@ static int os_host_main_loop_wait(uint32_t timeout) } g_main_context_prepare(context, &max_priority); - n_poll_fds = g_main_context_query(context, max_priority, &timeout, + n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout, poll_fds, ARRAY_SIZE(poll_fds)); g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds)); @@ -438,8 +439,12 @@ static int os_host_main_loop_wait(uint32_t timeout) 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, timeout); + ret = g_poll(poll_fds, n_poll_fds + w->num, poll_timeout); qemu_mutex_lock_iothread(); if (ret > 0) { for (i = 0; i < w->num; i++) {