Use alertable wait functions so that I/O completion routines or user-mode
authorTor Lillqvist <tml@novell.com>
Sun, 24 Feb 2008 01:46:42 +0000 (01:46 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sun, 24 Feb 2008 01:46:42 +0000 (01:46 +0000)
2008-02-24  Tor Lillqvist  <tml@novell.com>

* glib/gmain.c (g_poll) [Win32]: Use alertable wait functions so
that I/O completion routines or user-mode Asynchronous Procedure
Calls can be run. (#517484, Vlad Grecescu)

svn path=/trunk/; revision=6571

ChangeLog
glib/gmain.c

index add20afa7f89045548004f9f8ae566046650157c..27a1ae3ea4dcd28b17488f2e30f30627cbdf36a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-24  Tor Lillqvist  <tml@novell.com>
+
+       * glib/gmain.c (g_poll) [Win32]: Use alertable wait functions so
+       that I/O completion routines or user-mode Asynchronous Procedure
+       Calls can be run. (#517484, Vlad Grecescu)
+
 2008-02-24  Tor Lillqvist  <tml@novell.com>
 
        * glib/gwin32.c
index 74a3c800bad38164ed9aad0e190677d836b7841e..8d1c900c24a13634abf413e1f9da3559bf9093d8 100644 (file)
@@ -426,18 +426,18 @@ g_poll (GPollFD *fds,
          else
            {
              /* Wait for either message or event
-              * -> Use MsgWaitForMultipleObjects
+              * -> Use MsgWaitForMultipleObjectsEx
               */
 #ifdef G_MAIN_POLL_DEBUG
-             g_print ("MsgWaitForMultipleObjects(%d, %d)\n", nhandles, timeout);
+             g_print ("MsgWaitForMultipleObjectsEx(%d, %d)\n", nhandles, timeout);
 #endif
-             ready = MsgWaitForMultipleObjects (nhandles, handles, FALSE,
-                                                timeout, QS_ALLINPUT);
+             ready = MsgWaitForMultipleObjectsEx (nhandles, handles, timeout,
+                                                  QS_ALLINPUT, MWMO_ALERTABLE);
 
              if (ready == WAIT_FAILED)
                {
                  gchar *emsg = g_win32_error_message (GetLastError ());
-                 g_warning (G_STRLOC ": MsgWaitForMultipleObjects() failed: %s", emsg);
+                 g_warning (G_STRLOC ": MsgWaitForMultipleObjectsEx() failed: %s", emsg);
                  g_free (emsg);
                }
            }
@@ -451,16 +451,16 @@ g_poll (GPollFD *fds,
   else
     {
       /* Wait for just events
-       * -> Use WaitForMultipleObjects
+       * -> Use WaitForMultipleObjectsEx
        */
 #ifdef G_MAIN_POLL_DEBUG
-      g_print ("WaitForMultipleObjects(%d, %d)\n", nhandles, timeout);
+      g_print ("WaitForMultipleObjectsEx(%d, %d)\n", nhandles, timeout);
 #endif
-      ready = WaitForMultipleObjects (nhandles, handles, FALSE, timeout);
+      ready = WaitForMultipleObjectsEx (nhandles, handles, FALSE, timeout, TRUE);
       if (ready == WAIT_FAILED)
        {
          gchar *emsg = g_win32_error_message (GetLastError ());
-         g_warning (G_STRLOC ": WaitForMultipleObjects() failed: %s", emsg);
+         g_warning (G_STRLOC ": WaitForMultipleObjectsEx() failed: %s", emsg);
          g_free (emsg);
        }
     }
@@ -477,7 +477,8 @@ g_poll (GPollFD *fds,
 
   if (ready == WAIT_FAILED)
     return -1;
-  else if (ready == WAIT_TIMEOUT)
+  else if (ready == WAIT_TIMEOUT ||
+          ready == WAIT_IO_COMPLETION)
     return 0;
   else if (poll_msgs && ready == WAIT_OBJECT_0 + nhandles)
     {