mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 15:14:07 +02:00
parent
b7d4593b8c
commit
9905a4e09b
@ -23,6 +23,7 @@
|
|||||||
#include "base/utility.h"
|
#include "base/utility.h"
|
||||||
#include "base/logger_fwd.h"
|
#include "base/logger_fwd.h"
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/thread/condition_variable.hpp>
|
#include <boost/thread/condition_variable.hpp>
|
||||||
@ -240,9 +241,10 @@ void Timer::AdjustTimers(double adjustment)
|
|||||||
typedef boost::multi_index::nth_index<TimerSet, 1>::type TimerView;
|
typedef boost::multi_index::nth_index<TimerSet, 1>::type TimerView;
|
||||||
TimerView& idx = boost::get<1>(l_Timers);
|
TimerView& idx = boost::get<1>(l_Timers);
|
||||||
|
|
||||||
TimerView::iterator it;
|
std::vector<Timer::Ptr> timers;
|
||||||
for (it = idx.begin(); it != idx.end(); it++) {
|
|
||||||
Timer::Ptr timer = it->lock();
|
BOOST_FOREACH(const Timer::WeakPtr& wtimer, idx) {
|
||||||
|
Timer::Ptr timer = wtimer.lock();
|
||||||
|
|
||||||
if (!timer)
|
if (!timer)
|
||||||
continue;
|
continue;
|
||||||
@ -250,11 +252,14 @@ void Timer::AdjustTimers(double adjustment)
|
|||||||
if (abs(now - (timer->m_Next + adjustment)) <
|
if (abs(now - (timer->m_Next + adjustment)) <
|
||||||
abs(now - timer->m_Next)) {
|
abs(now - timer->m_Next)) {
|
||||||
timer->m_Next += adjustment;
|
timer->m_Next += adjustment;
|
||||||
l_Timers.erase(timer);
|
timers.push_back(timer);
|
||||||
l_Timers.insert(timer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_FOREACH(const Timer::Ptr& timer, timers) {
|
||||||
|
l_Timers.erase(timer);
|
||||||
|
l_Timers.insert(timer);
|
||||||
|
}
|
||||||
/* Notify the worker that we've rescheduled some timers. */
|
/* Notify the worker that we've rescheduled some timers. */
|
||||||
l_CV.notify_all();
|
l_CV.notify_all();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user