OSDN Git Service

glib: fix g_poll early timeout on windows
authorSangho Park <sangho1206.park@samsung.com>
Thu, 8 May 2014 08:47:10 +0000 (12:47 +0400)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 9 May 2014 18:57:35 +0000 (20:57 +0200)
commit5a007547df76446ab891df93ebc55749716609bf
tree22de00b700cd18acc30e65959e6270bf8226a5ea
parentfd040174ac7c302365c1d6dc5646f957972d67d6
glib: fix g_poll early timeout on windows

g_poll has a problem on Windows when using
timeouts < 10ms, in glib/gpoll.c:

/* If not, and we have a significant timeout, poll again with
 * timeout then. Note that this will return indication for only
 * one event, or only for messages. We ignore timeouts less than
 * ten milliseconds as they are mostly pointless on Windows, the
 * MsgWaitForMultipleObjectsEx() call will timeout right away
 * anyway.
 */
if (retval == 0 && (timeout == INFINITE || timeout >= 10))
  retval = poll_rest (poll_msgs, handles, nhandles, fds, nfds, timeout);

so whenever g_poll is called with timeout < 10ms it does
a quick poll instead of wait, this causes significant performance
degradation of QEMU, thus we should use WaitForMultipleObjectsEx
directly

Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
include/glib-compat.h
util/oslib-win32.c