X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Ftimer.cc;fp=src%2Fmoof%2Ftimer.cc;h=89f3e9da825676ef16e8ad94086e52f91615af74;hp=5bb2092af68591a8dc6fa3df03dd5d0ecd736b3e;hb=1da520638918096276158ecdfaeebc14a3d70be7;hpb=51069fee9139ab8d14ecc80dffbe5deecb73d9e0 diff --git a/src/moof/timer.cc b/src/moof/timer.cc index 5bb2092..89f3e9d 100644 --- a/src/moof/timer.cc +++ b/src/moof/timer.cc @@ -113,7 +113,7 @@ scalar timer::find_next_expiration() scalar next_fire = std::numeric_limits::max(); hash::iterator it; - for (it = timers_.begin(); it != timers_.end(); ++it) + for (it = timers_.begin(); it.valid(); ++it) { scalar absolute = (*it).second->absolute_; if (absolute < next_fire) next_fire = absolute; @@ -149,10 +149,12 @@ void timer::fire_expired_timers(scalar t) if (next_expiration_ > t) return; hash::iterator it; - for (it = timers_.begin(); it != timers_.end(); ++it) + for (it = timers_.begin(); it.valid(); ++it) { timer* timer = (*it).second; if (timer->is_expired()) timer->fire(); + + if (it.end()) break; } }