diff --git a/glib/gpoll.c b/glib/gpoll.c index b6c83d8ed..694f1f9a1 100644 --- a/glib/gpoll.c +++ b/glib/gpoll.c @@ -164,10 +164,11 @@ poll_rest (gboolean poll_msgs, if (timeout == INFINITE) ready = WAIT_FAILED; else - { - SleepEx (timeout, TRUE); - ready = WAIT_TIMEOUT; - } + { + /* Wait for the current process to die, more efficient than SleepEx(). */ + WaitForSingleObjectEx (GetCurrentProcess (), timeout, TRUE); + ready = WAIT_TIMEOUT; + } } else {