Rework the g_poll() implementation on Windows to match poll() semantics
authorTor Lillqvist <tml@novell.com>
Thu, 21 Aug 2008 02:27:13 +0000 (02:27 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 21 Aug 2008 02:27:13 +0000 (02:27 +0000)
commit605682521b501912a8a0c2e66a24bca171ae0df1
tree88e1a09d7a93e6499f4ce73cdbafd5895ca101f3
parent0f7359d21582c26a6490fb95d3907f2c4e2b5957
Rework the g_poll() implementation on Windows to match poll() semantics

2008-08-21  Tor Lillqvist  <tml@novell.com>

* glib/gmain.c: Rework the g_poll() implementation on Windows to
match poll() semantics more closely. This makes the test program
in bug #468910 behave better and doesn't seem to break anything
else.

If polling several GPollFDs, i.e. messages and/or waitable
handles, first check if one or several of them are in the
signalled state right away, and return indication for all that are
in that case.

If not, then poll with timeout and indicate only the single one
that the Win32 wait function tells us as before.

Remove unnecessary ifdefs, as we always have G_MAIN_POLL_DEBUG
defined on Windows.

Initialise g_main_poll_debug in g_main_context_new() so we have it
before testing it in one case.

Don't add several copies of a handle in the array of handles to
wait for. The documentation says this is not allowed, although it
did seem to work fine in practise. But do as the documentations
says anyway.

svn path=/trunk/; revision=7375
ChangeLog
glib/gmain.c