mirror of
https://github.com/espressif/openthread.git
synced 2026-08-25 11:49:51 +00:00
Timer: Make Timer implementation robust against late firing platform alarm (#1917)
This commit changes the timer code to make the implementation robust against late firing platform alarm case. In particular, it addresses the (rare corner-case) scenario where alarm fire is late and the head timer in the linked-list is already expired and then a new timer is started with maximum interval. This can possibly violate the requirement for `TimerScheduler::IsStringlyBefore()` method that the two times being compared should not differ more than the maximum interval `Timer::kMaxDt`. To address this, a new method `Timer::DoesFireBefore()` is added to compare fire time of two timers which checks for expired timers. This commit also updates the timer unit test to add test cases related to the late firing alarm.
This commit is contained in:
committed by
Jonathan Hui
parent
49e7977d84
commit
c99b4fb921
@@ -79,6 +79,7 @@ namespace ot
|
||||
|
||||
// test_timer.cpp
|
||||
int TestOneTimer();
|
||||
int TestTwoTimers();
|
||||
int TestTenTimers();
|
||||
|
||||
// test_toolchain.cpp
|
||||
@@ -159,6 +160,7 @@ namespace ot
|
||||
|
||||
// test_timer.cpp
|
||||
TEST_METHOD(TestOneTimer) { ::TestOneTimer(); }
|
||||
TEST_METHOD(TestTwoTimers) { ::TestTwoTimers(); }
|
||||
TEST_METHOD(TestTenTimers) { ::TestTenTimers(); }
|
||||
|
||||
// test_ncp_buffer.cpp
|
||||
|
||||
Reference in New Issue
Block a user