/ohos5.0/commonlibrary/c_utils/base/src/ |
H A D | timer.cpp | 87 if (timerFd == INVALID_TIMER_FD) { in Register() 106 entry->timerFd = timerFd; in Register() 132 timers_.erase((*itor)->timerFd); in Unregister() 164 timers_[timerFd] = interval; in DoRegister() 177 void Timer::OnTimer(int timerFd) in OnTimer() argument 183 interval = timers_[timerFd]; in OnTimer() 189 if (ptr->timerFd != timerFd) { in OnTimer() 210 callback(timerFd); in DoTimerListCallback() 233 return ptr->timerFd; in GetTimerFd() 250 reactor_->CancelTimer((*itor)->timerFd); in EraseUnusedTimerId() [all …]
|
H A D | event_reactor.cpp | 95 uint32_t EventReactor::ScheduleTimer(const TimerCallback& cb, uint32_t interval, int& timerFd, bool… in ScheduleTimer() argument 106 timerFd = handler->GetHandle(); in ScheduleTimer() 111 void EventReactor::CancelTimer(int timerFd) in CancelTimer() argument 113 UTILS_LOGD("Cancel timer, timerFd: %{public}d.", timerFd); in CancelTimer() 117 if ((*itor)->GetHandle() == timerFd) { in CancelTimer()
|
H A D | event_reactor.h | 34 using TimerCallback = std::function<void(int timerFd)>; 67 …uint32_t ScheduleTimer(const TimerCallback& cb, uint32_t interval /* ms */, int& timerFd, bool onc… 68 void CancelTimer(int timerFd);
|
H A D | timer_event_handler.h | 30 using TimerCallback = std::function<void(int timerFd)>;
|
/ohos5.0/foundation/communication/bluetooth_service/services/bluetooth/stack/platform/linux/ |
H A D | alarm_linux.c | 38 int timerFd; member 76 int ret = read(alarm->timerFd, &value, sizeof(uint64_t)); in AlarmNotify() 110 int timerFd = timerfd_create(BT_CLOCK_MONOTONIC, TFD_NONBLOCK); in AlarmCreate() local 111 if (timerFd == -1) { in AlarmCreate() 118 close(timerFd); in AlarmCreate() 123 alarm->timerFd = timerFd; in AlarmCreate() 128 …ReactorRegister(ThreadGetReactor(g_alarmThread), alarm->timerFd, (void *)alarm, AlarmNotify, NULL); in AlarmCreate() 130 close(timerFd); in AlarmCreate() 155 close(alarm->timerFd); in AlarmDelete() 176 if (timerfd_settime(alarm->timerFd, 0, &its, NULL) == -1) { in AlarmSet() [all …]
|
/ohos5.0/commonlibrary/c_utils/base/include/ |
H A D | timer.h | 53 using TimerListCallback = std::function<void (int timerFd)>; 118 void OnTimer(int timerFd); 119 …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
|
/ohos5.0/base/msdp/device_status/test/unittest/intention/scheduler/src/ |
H A D | timer_manager_test.cpp | 547 int32_t timerFd = timerMgr->GetTimerFd(); variable 548 if (timerFd < 0) { 553 EXPECT_GE(timerFd, 0); 565 int32_t timerFd = timerMgr.GetTimerFd(); variable 566 if (timerFd < 0) { 567 FI_HILOGI("TimerFd is less than zero. the value is %{public}d", timerFd); 569 FI_HILOGE("Get TimerFd failed. the value is %{public}d", timerFd); 571 EXPECT_LT(timerFd, 0);
|
/ohos5.0/commonlibrary/c_utils/base/test/unittest/common/ |
H A D | utils_event_test.cpp | 548 TimerEventHandler(int timerFd, uint32_t timeout, bool once); 610 …cheduleTimer(const TimerEventCallback& callback, uint32_t interval, uint32_t timerId, int& timerFd, 678 int& timerFd, bool once) in ScheduleTimer() argument 680 …std::shared_ptr<TimerEventHandler> handler = std::make_shared<TimerEventHandler>(timerFd, interval… 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 << std::endl; in Register() 806 TimerEventHandler::TimerEventHandler(int timerFd, uint32_t timeout /* ms */, bool once) in TimerEventHandler() argument 809 if (timerFd == IO_EVENT_INVALID_FD) { in TimerEventHandler() [all …]
|
/ohos5.0/commonlibrary/c_utils/base/test/benchmarktest/event_benchmark_test/ |
H A D | event_benchmark_test.cpp | 680 TimerEventHandler(int timerFd, uint32_t timeout, bool once); 813 uint32_t timerId, int& timerFd, bool once) in ScheduleTimer() argument 816 …std::shared_ptr<TimerEventHandler> handler = std::make_shared<TimerEventHandler>(timerFd, interval… 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 849 uint32_t ret = ScheduleTimer(wrappedCb, interval, timerId, timerFd, once); in Register() 852 "timer-fd:%{public}d", gettid(), timerId, interval, timerFd); in Register() 947 TimerEventHandler::TimerEventHandler(int timerFd, uint32_t timeout /* ms */, bool once) in TimerEventHandler() argument 951 if (timerFd == IO_EVENT_INVALID_FD) { in TimerEventHandler() [all …]
|
/ohos5.0/commonlibrary/c_utils/docs/zh-cn/ |
H A D | c_utils_timer.md | 63 2. 出于节省资源,提高性能的考虑,相同interval事件会复用timerFd,这可能导致部分事件响应时间与预期存在偏差,如果开发者对该响应时间有强要求,建议设置interval略带偏差(如1ms)
|
/ohos5.0/commonlibrary/c_utils/docs/en/ |
H A D | c_utils_timer.md | 62 2. To save resources and improve performance, timerFd is reused for events with the same interval. …
|