mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-19 15:18:55 +02:00
glib/gpoll W32: use WFSOE() instead of SleepEx()
WaitForSingleObjectEx() is supposed to be a more efficient sleep method. It waits on the handle of the current process. That handle will be signaled once the process terminates, and since we're *inside* the process, it'll never happen (and if it does, we won't care anymore). The use of an alertable wait ensures that we wake up when a completion routine wants to run. https://bugzilla.gnome.org/show_bug.cgi?id=785468
This commit is contained in:
@@ -164,10 +164,11 @@ poll_rest (gboolean poll_msgs,
|
|||||||
if (timeout == INFINITE)
|
if (timeout == INFINITE)
|
||||||
ready = WAIT_FAILED;
|
ready = WAIT_FAILED;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SleepEx (timeout, TRUE);
|
/* Wait for the current process to die, more efficient than SleepEx(). */
|
||||||
ready = WAIT_TIMEOUT;
|
WaitForSingleObjectEx (GetCurrentProcess (), timeout, TRUE);
|
||||||
}
|
ready = WAIT_TIMEOUT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user