X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Ftime%2Ftimer.cpp;fp=source%2Ftime%2Ftimer.cpp;h=eda782e0d92c5bf82c00418584e12917d03fa673;hp=04c3074494e921d39f3edb54e53e378c8623e826;hb=39da82b967c70282973025e4b12186625e29fe26;hpb=af9f2e378f3adea7e636bac3c320ad2272af7612 diff --git a/source/time/timer.cpp b/source/time/timer.cpp index 04c3074..eda782e 100644 --- a/source/time/timer.cpp +++ b/source/time/timer.cpp @@ -22,7 +22,7 @@ Timer::Slot &Timer::add(const TimeDelta &td) { Slot *s = new Slot(td); MutexLock l(mutex); - slots.push_back(s); + slots.push_back({ s }); push_heap(slots.begin(), slots.end()); if(blocking) sem.signal(); @@ -33,7 +33,7 @@ Timer::Slot &Timer::add(const TimeStamp &ts) { Slot *s = new Slot(ts); MutexLock l(mutex); - slots.push_back(s); + slots.push_back({ s }); push_heap(slots.begin(), slots.end()); if(blocking) sem.signal(); @@ -113,7 +113,7 @@ void Timer::do_tick(const TimeDelta &timeout) if(next->signal_timeout.emit() && next->increment()) { MutexLock l(mutex); - slots.push_back(next); + slots.push_back({ next }); push_heap(slots.begin(), slots.end()); } else @@ -152,10 +152,6 @@ bool Timer::Slot::increment() } -Timer::SlotProxy::SlotProxy(Slot *s): - slot(s) -{ } - bool Timer::SlotProxy::operator<(const SlotProxy &sp) const { return slot->get_timeout()>sp.slot->get_timeout();