[glib/fix-gnulib-msvc-isnan: 24/37] win32 gpoll: Fix wait for at least one thread to return



commit c84da3990ddb41561e537c0080cff92b50c50fbe
Author: majordaw <major david balasys hu>
Date:   Wed May 20 15:30:57 2020 +0200

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]