From 66b56ee9d8cb58d70b2e4708487bef1ff7e50faf Mon Sep 17 00:00:00 2001 From: majordaw Date: Wed, 20 May 2020 15:30:57 +0200 Subject: [PATCH] win32 gpoll: Fix wait for at least one thread to return When timeout grater than 0 in g_poll function, the WaitForMultipleObjects call will wait for all the threads to return, but when only one thread got an event the others will sleep until the timeout elapses, and causes a stall. Triggering the stop event in g_poll in this case is useless as it is triggered when all the threads where already signaled or timed-out. Closes: https://gitlab.gnome.org/GNOME/glib/issues/2107 --- glib/gpoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gpoll.c b/glib/gpoll.c index 290c64c3c..2681d91f9 100644 --- a/glib/gpoll.c +++ b/glib/gpoll.c @@ -450,7 +450,7 @@ g_poll (GPollFD *fds, ready = MsgWaitForMultipleObjectsEx (nthreads, thread_handles, timeout, QS_ALLINPUT, MWMO_ALERTABLE); else - ready = WaitForMultipleObjects (nthreads, thread_handles, timeout > 0, timeout); + ready = WaitForMultipleObjects (nthreads, thread_handles, FALSE, timeout); /* Signal the stop in case any of the threads did not stop yet */ if (!SetEvent ((HANDLE)stop_event.fd))