mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
Removed global variable.
This commit is contained in:
parent
238e02b56a
commit
70df015ed0
@ -7,7 +7,7 @@ using std::list;
|
|||||||
using std::bind2nd;
|
using std::bind2nd;
|
||||||
using std::equal_to;
|
using std::equal_to;
|
||||||
|
|
||||||
static time_t g_NextCall;
|
time_t Timer::NextCall;
|
||||||
list<Timer::WeakRefType> Timer::Timers;
|
list<Timer::WeakRefType> Timer::Timers;
|
||||||
|
|
||||||
Timer::Timer(void)
|
Timer::Timer(void)
|
||||||
@ -17,16 +17,16 @@ Timer::Timer(void)
|
|||||||
|
|
||||||
time_t Timer::GetNextCall(void)
|
time_t Timer::GetNextCall(void)
|
||||||
{
|
{
|
||||||
if (g_NextCall < time(NULL))
|
if (NextCall < time(NULL))
|
||||||
Timer::RescheduleTimers();
|
Timer::RescheduleTimers();
|
||||||
|
|
||||||
return g_NextCall;
|
return NextCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::RescheduleTimers(void)
|
void Timer::RescheduleTimers(void)
|
||||||
{
|
{
|
||||||
/* Make sure we wake up at least once every 30 seconds */
|
/* Make sure we wake up at least once every 30 seconds */
|
||||||
g_NextCall = time(NULL) + 30;
|
NextCall = time(NULL) + 30;
|
||||||
|
|
||||||
for (list<Timer::WeakRefType>::iterator i = Timers.begin(); i != Timers.end(); i++) {
|
for (list<Timer::WeakRefType>::iterator i = Timers.begin(); i != Timers.end(); i++) {
|
||||||
Timer::RefType timer = i->lock();
|
Timer::RefType timer = i->lock();
|
||||||
@ -34,8 +34,8 @@ void Timer::RescheduleTimers(void)
|
|||||||
if (timer == NULL)
|
if (timer == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (timer->m_Next < g_NextCall)
|
if (timer->m_Next < NextCall)
|
||||||
g_NextCall = timer->m_Next;
|
NextCall = timer->m_Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user