/commonlibrary/c_utils/base/src/ |
H A D | timer.cpp | 86 int timerFd = once ? INVALID_TIMER_FD : GetTimerFd(interval); in Register() local 87 if (timerFd == INVALID_TIMER_FD) { in Register() 88 uint32_t ret = DoRegister([this](int fd) { this->OnTimer(fd); }, interval, once, timerFd); in Register() 106 entry->timerFd = timerFd; in Register() 131 reactor_->CancelTimer((*itor)->timerFd); in Unregister() 132 timers_.erase((*itor)->timerFd); in Unregister() 156 uint32_t Timer::DoRegister(const TimerListCallback& callback, uint32_t interval, bool once, int &timerFd) in DoRegister() argument 159 uint32_t ret = reactor_->ScheduleTimer(cb, interval, timerFd, once); in DoRegister() 160 if ((ret != TIMER_ERR_OK) || (timerFd < in DoRegister() 177 OnTimer(int timerFd) OnTimer() argument 208 DoTimerListCallback(const TimerListCallback& callback, int timerFd) DoTimerListCallback() argument [all...] |
H A D | event_reactor.cpp | 98 uint32_t EventReactor::ScheduleTimer(const TimerCallback& cb, uint32_t interval, int& timerFd, bool once) in ScheduleTimer() argument 109 timerFd = handler->GetHandle(); in ScheduleTimer() 114 void EventReactor::CancelTimer(int timerFd) in CancelTimer() argument 116 UTILS_LOGD("Cancel timer, timerFd: %{public}d.", timerFd); in CancelTimer() 120 if ((*itor)->GetHandle() == timerFd) { in CancelTimer()
|
H A D | event_reactor.h | 36 using TimerCallback = std::function<void(int timerFd)>; 69 uint32_t ScheduleTimer(const TimerCallback& cb, uint32_t interval /* ms */, int& timerFd, bool once); 70 void CancelTimer(int timerFd);
|
H A D | timer_event_handler.h | 30 using TimerCallback = std::function<void(int timerFd)>;
|
/commonlibrary/c_utils/base/include/ |
H A D | timer.h | 53 using TimerListCallback = std::function<void (int timerFd)>; 118 void OnTimer(int timerFd); 119 virtual uint32_t DoRegister(const TimerListCallback& callback, uint32_t interval, bool once, int &timerFd); 121 void DoTimerListCallback(const TimerListCallback& callback, int timerFd); 132 int timerFd; member
|
/commonlibrary/c_utils/base/test/benchmarktest/event_benchmark_test/ |
H A D | event_benchmark_test.cpp | 381 BENCHMARK_LOGD("Set timerFd failed-%{public}s timer_fd:%{public}d", strerror(errno), GetFd()); in Initialize() 680 TimerEventHandler(int timerFd, uint32_t timeout, bool once); 741 ErrCode ScheduleTimer(const TimerEventCallback& callback, uint32_t interval, uint32_t timerId, int& timerFd, 813 uint32_t timerId, int& timerFd, bool once) in ScheduleTimer() 816 std::shared_ptr<TimerEventHandler> handler = std::make_shared<TimerEventHandler>(timerFd, interval, once); in ScheduleTimer() 817 BENCHMARK_LOGD("Timer::ScheduleTimer interval: %{public}u -- timerId: %{public}u -- timerFd: %{public}d", in ScheduleTimer() 818 interval, timerId, timerFd); in ScheduleTimer() 834 timerFd = handler->GetTimerFd(); in ScheduleTimer() 846 int timerFd = once ? IO_EVENT_INVALID_FD : GetTimerFd(interval); // Get timerFd in Register() local 812 ScheduleTimer(const TimerEventCallback& callback, uint32_t interval, uint32_t timerId, int& timerFd, bool once) ScheduleTimer() argument 947 TimerEventHandler(int timerFd, uint32_t timeout , bool once) TimerEventHandler() argument [all...] |
/commonlibrary/c_utils/base/test/unittest/common/ |
H A D | utils_event_test.cpp | 279 std::cout << "Set timerFd failed-" << strerror(errno) << "timer_fd:" << GetFd() << ", next_time:" << in Initialize() 548 TimerEventHandler(int timerFd, uint32_t timeout, bool once); 610 ErrCode ScheduleTimer(const TimerEventCallback& callback, uint32_t interval, uint32_t timerId, int& timerFd, 678 int& timerFd, bool once) in ScheduleTimer() 680 std::shared_ptr<TimerEventHandler> handler = std::make_shared<TimerEventHandler>(timerFd, interval, once); in ScheduleTimer() 696 timerFd = handler->GetTimerFd(); in ScheduleTimer() 707 int timerFd = once ? IO_EVENT_INVALID_FD : GetTimerFd(interval); // Get timerFd in Register() local 710 uint32_t ret = ScheduleTimer(wrappedCb, interval, timerId, timerFd, once); in Register() 713 timerId << ", interval:" << interval << "timer-fd:" << timerFd << st in Register() 677 ScheduleTimer(const TimerEventCallback& callback, uint32_t interval, uint32_t timerId, int& timerFd, bool once) ScheduleTimer() argument 806 TimerEventHandler(int timerFd, uint32_t timeout , bool once) TimerEventHandler() argument [all...] |