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
This commit is contained in:
majordaw 2020-05-20 15:30:57 +02:00
parent e816e9c86f
commit 26991b6093

View File

@ -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))