a8/a8/timer_attacher.cc
2018-08-26 20:34:01 +08:00

30 lines
588 B
C++

#include <a8/a8.h>
#include <a8/timer.h>
#include <a8/timer_attacher.h>
namespace a8
{
TimerAttacher::TimerAttacher()
{
INIT_LIST_HEAD(&timer_list_);
}
TimerAttacher::~TimerAttacher()
{
ClearTimerList();
}
void TimerAttacher::ClearTimerList()
{
struct list_head* pos = nullptr;
struct list_head* n = nullptr;
list_for_each_safe(pos, n, &timer_list_){
timer_list* tmp_timer = a8::Timer::Instance()->GetTimerByAttach(pos);
a8::Timer::Instance()->DeleteTimer(tmp_timer);
}
}
}