Hi, see below On 04/18/2014 12:03 PM, Stefan Weil wrote: > Am 18.04.2014 09:34, schrieb Stanislav Vorobiov: >> Hi, >> >> Please see below >> >> On 04/18/2014 10:46 AM, Stefan Weil wrote: >>> Hi, > [...] >> >>> >>> Would it be sufficient to round any timeout > 0 and < 10 to 10 for >>> Windows hosts? Maybe this could be done in qemu_timeout_ns_to_ms. >> We tried that, it gets almost as good as with this patch, but this >> makes timeouts like, say, 2ms wait for 10ms, so with this patch it's >> still better. >> >>> If >>> this does not work, we still can use g_poll for timeout >= 10 and call a >>> new Windows specific polling function for timeout < 10. >> Does it have a point to separate things, if we've implemented this for >> timeouts < 10ms >> why not use it for timeouts >= 10ms ? The code in this patch is in fact >> g_poll's >> implementation without that "timeout >= 10" hack and it handles timeouts >= >> 10ms >> as well as g_poll does. > > > Did you send a bug report to the maintainers of glib? I think it would > be good to do so. I've filed a bug report here - https://bugzilla.gnome.org/show_bug.cgi?id=728486
> > We can override the buggy implementation of g_poll for Windows by > redirecting any call of g_poll to a new g_poll_fixed function. > > In file include/glib-compat.h: > > #if defined(_WIN32) > /* g_poll does not handle timeout < 10 ms correctly, so use wrapper. */ > #define g_poll(fds, nfds, timeout) g_poll_fixed((fds, nfds, timeout) > gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout); > #endif > > Then move your code into a new function g_poll_fixed() in file > util/oslib-win32.c (and add there some comments, too). > > There is also some g_poll code in include/qemu-common.h. This should > also be moved to include/glib-compat.h and must be excluded for _WIN32 > when you add g_poll_fixed. > > Stefan > >