Fix deprecation warnings on DMD 2.071.0.

This commit is contained in:
Sönke Ludwig 2016-05-18 12:47:30 +02:00
parent 0b7adc993f
commit 87487f9e71
2 changed files with 8 additions and 6 deletions

View file

@ -55,6 +55,7 @@ final class EpollEventDriver : PosixEventDriver {
override void dispose() override void dispose()
{ {
import core.sys.posix.unistd : close;
close(m_epoll); close(m_epoll);
} }

View file

@ -14,7 +14,7 @@ mixin template DefaultTimerImpl() {
import std.container.array; import std.container.array;
import std.datetime : Clock; import std.datetime : Clock;
import std.range : SortedRange, assumeSorted, take; import std.range : SortedRange, assumeSorted, take;
import core.time : hnsecs; import core.time : hnsecs, Duration;
private { private {
static FreeList!(Mallocator, TimerSlot.sizeof) ms_allocator; static FreeList!(Mallocator, TimerSlot.sizeof) ms_allocator;
@ -59,7 +59,8 @@ mixin template DefaultTimerImpl() {
m_timerQueue.linearRemove(elems); m_timerQueue.linearRemove(elems);
foreach (tm; m_firedTimers) foreach (tm; m_firedTimers)
tm.callback(tm.id); foreach (cb; tm.callbacks)
cb(tm.id);
m_firedTimers.length = 0; m_firedTimers.length = 0;
m_firedTimers.assumeSafeAppend(); m_firedTimers.assumeSafeAppend();
@ -74,7 +75,7 @@ mixin template DefaultTimerImpl() {
assert(tm !is null); assert(tm !is null);
tm.id = id; tm.id = id;
tm.refCount = 1; tm.refCount = 1;
tm.callback = callback; tm.callbacks ~= callback;
m_timers[id] = tm; m_timers[id] = tm;
return id; return id;
} }
@ -98,7 +99,7 @@ mixin template DefaultTimerImpl() {
auto tm = m_timers[timer]; auto tm = m_timers[timer];
if (!tm.pending) return; if (!tm.pending) return;
tm.pending = false; tm.pending = false;
tm.callback = null; tm.callbacks.length = 0;
TimerSlot cmp = void; TimerSlot cmp = void;
cmp.timeout = tm.timeout-1; cmp.timeout = tm.timeout-1;
@ -126,7 +127,7 @@ mixin template DefaultTimerImpl() {
final override void waitTimer(TimerID timer, TimerCallback callback) final override void waitTimer(TimerID timer, TimerCallback callback)
{ {
assert(false); m_timers[timer].callbacks ~= callback;
} }
final override void addRef(TimerID descriptor) final override void addRef(TimerID descriptor)
@ -151,5 +152,5 @@ struct TimerSlot {
bool pending; bool pending;
long timeout; // stdtime long timeout; // stdtime
long repeatDuration; long repeatDuration;
TimerCallback callback; TimerCallback[] callbacks; // TODO: use a list with small-value optimization
} }