Fix compilation on older DMD frontends.

This commit is contained in:
Sönke Ludwig 2018-10-27 16:31:59 +02:00
parent 78fef30310
commit f5665aa7c1

View file

@ -1039,7 +1039,7 @@ struct Timer {
if (callback) { if (callback) {
m_driver.timers.userData!Callback(m_id) = callback; m_driver.timers.userData!Callback(m_id) = callback;
m_driver.timers.wait(m_id, timerCallbackHandler); m_driver.timers.wait(m_id, &TimerCallbackHandler.instance.handle);
} }
} }
@ -1094,15 +1094,19 @@ struct Timer {
} }
} }
private immutable TimerCallback2 timerCallbackHandler = (TimerID timer, bool fired) { struct TimerCallbackHandler {
static TimerCallbackHandler instance;
void handle(TimerID timer, bool fired)
@safe nothrow {
if (fired) { if (fired) {
auto cb = eventDriver.timers.userData!(Timer.Callback)(timer); auto cb = eventDriver.timers.userData!(Timer.Callback)(timer);
cb(); cb();
} }
if (!eventDriver.timers.isUnique(timer)) if (!eventDriver.timers.isUnique(timer))
eventDriver.timers.wait(timer, timerCallbackHandler); eventDriver.timers.wait(timer, &handle);
}; }
}
/** Returns an object that ensures that no task switches happen during its life time. /** Returns an object that ensures that no task switches happen during its life time.