Remove special case for zero-wait processing off events.
This ensures that all kinds of events are processed, including timers and I/O events.
This commit is contained in:
parent
abdbc91c4b
commit
5d317ca9e7
|
@ -73,12 +73,6 @@ final class WinAPIEventDriverCore : EventDriverCore {
|
||||||
if (!waiterCount) return ExitReason.outOfWaiters;
|
if (!waiterCount) return ExitReason.outOfWaiters;
|
||||||
|
|
||||||
bool got_event;
|
bool got_event;
|
||||||
|
|
||||||
if (timeout <= 0.seconds) {
|
|
||||||
got_event = doProcessEvents(0.seconds);
|
|
||||||
got_event |= m_timers.process(currStdTime);
|
|
||||||
return got_event ? ExitReason.idle : ExitReason.timeout;
|
|
||||||
} else {
|
|
||||||
long now = currStdTime;
|
long now = currStdTime;
|
||||||
do {
|
do {
|
||||||
auto nextto = min(m_timers.getNextTimeout(now), timeout);
|
auto nextto = min(m_timers.getNextTimeout(now), timeout);
|
||||||
|
@ -94,7 +88,6 @@ final class WinAPIEventDriverCore : EventDriverCore {
|
||||||
if (timeout != Duration.max)
|
if (timeout != Duration.max)
|
||||||
timeout -= (now - prev_step).hnsecs;
|
timeout -= (now - prev_step).hnsecs;
|
||||||
} while (timeout > 0.seconds);
|
} while (timeout > 0.seconds);
|
||||||
}
|
|
||||||
|
|
||||||
if (!waiterCount) return ExitReason.outOfWaiters;
|
if (!waiterCount) return ExitReason.outOfWaiters;
|
||||||
if (got_event) return ExitReason.idle;
|
if (got_event) return ExitReason.idle;
|
||||||
|
@ -159,14 +152,13 @@ final class WinAPIEventDriverCore : EventDriverCore {
|
||||||
private bool doProcessEvents(Duration max_wait)
|
private bool doProcessEvents(Duration max_wait)
|
||||||
{
|
{
|
||||||
import core.time : seconds;
|
import core.time : seconds;
|
||||||
import std.algorithm.comparison : min;
|
import std.algorithm.comparison : min, max;
|
||||||
|
|
||||||
executeThreadCallbacks();
|
executeThreadCallbacks();
|
||||||
|
|
||||||
bool got_event;
|
bool got_event;
|
||||||
|
|
||||||
if (max_wait > 0.seconds) {
|
DWORD timeout_msecs = max_wait == Duration.max ? INFINITE : cast(DWORD)min(max(max_wait.total!"msecs", 0), DWORD.max);
|
||||||
DWORD timeout_msecs = max_wait == Duration.max ? INFINITE : cast(DWORD)min(max_wait.total!"msecs", DWORD.max);
|
|
||||||
auto ret = () @trusted { return MsgWaitForMultipleObjectsEx(cast(DWORD)m_registeredEvents.length, m_registeredEvents.ptr,
|
auto ret = () @trusted { return MsgWaitForMultipleObjectsEx(cast(DWORD)m_registeredEvents.length, m_registeredEvents.ptr,
|
||||||
timeout_msecs, QS_ALLEVENTS, MWMO_ALERTABLE|MWMO_INPUTAVAILABLE); } ();
|
timeout_msecs, QS_ALLEVENTS, MWMO_ALERTABLE|MWMO_INPUTAVAILABLE); } ();
|
||||||
|
|
||||||
|
@ -192,7 +184,6 @@ final class WinAPIEventDriverCore : EventDriverCore {
|
||||||
foreach( fw; to_remove )
|
foreach( fw; to_remove )
|
||||||
m_fileWriters.remove(fw);
|
m_fileWriters.remove(fw);
|
||||||
}*/
|
}*/
|
||||||
}
|
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
//uint cnt = 0;
|
//uint cnt = 0;
|
||||||
|
|
Loading…
Reference in a new issue