Merge pull request #81 from vibe-d/windows_event_poll_fixes
Remove special case for zero-wait processing off events.
This commit is contained in:
commit
00ef149c04
|
@ -73,12 +73,6 @@ final class WinAPIEventDriverCore : EventDriverCore {
|
|||
if (!waiterCount) return ExitReason.outOfWaiters;
|
||||
|
||||
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;
|
||||
do {
|
||||
auto nextto = min(m_timers.getNextTimeout(now), timeout);
|
||||
|
@ -94,7 +88,6 @@ final class WinAPIEventDriverCore : EventDriverCore {
|
|||
if (timeout != Duration.max)
|
||||
timeout -= (now - prev_step).hnsecs;
|
||||
} while (timeout > 0.seconds);
|
||||
}
|
||||
|
||||
if (!waiterCount) return ExitReason.outOfWaiters;
|
||||
if (got_event) return ExitReason.idle;
|
||||
|
@ -159,14 +152,13 @@ final class WinAPIEventDriverCore : EventDriverCore {
|
|||
private bool doProcessEvents(Duration max_wait)
|
||||
{
|
||||
import core.time : seconds;
|
||||
import std.algorithm.comparison : min;
|
||||
import std.algorithm.comparison : min, max;
|
||||
|
||||
executeThreadCallbacks();
|
||||
|
||||
bool got_event;
|
||||
|
||||
if (max_wait > 0.seconds) {
|
||||
DWORD timeout_msecs = max_wait == Duration.max ? INFINITE : cast(DWORD)min(max_wait.total!"msecs", DWORD.max);
|
||||
DWORD timeout_msecs = max_wait == Duration.max ? INFINITE : cast(DWORD)min(max(max_wait.total!"msecs", 0), DWORD.max);
|
||||
auto ret = () @trusted { return MsgWaitForMultipleObjectsEx(cast(DWORD)m_registeredEvents.length, m_registeredEvents.ptr,
|
||||
timeout_msecs, QS_ALLEVENTS, MWMO_ALERTABLE|MWMO_INPUTAVAILABLE); } ();
|
||||
|
||||
|
@ -192,7 +184,6 @@ final class WinAPIEventDriverCore : EventDriverCore {
|
|||
foreach( fw; to_remove )
|
||||
m_fileWriters.remove(fw);
|
||||
}*/
|
||||
}
|
||||
|
||||
MSG msg;
|
||||
//uint cnt = 0;
|
||||
|
|
Loading…
Reference in a new issue