You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix timer cancellation to be reliable in LayerImplSelect. (#22375)
* Duplicate src/system/tests/TestSystemScheduleLambda.cpp history in src/system/tests/TestSystemScheduleWork.cpp history.
* Fix timer cancellation to be reliable in LayerImplSelect.
To minimize risk, the changes here keep the "grab all the timers we
should fire, then fire them" setup instead of switching to the "fire
the timers one at a time" approach LayerImplFreeRTOS uses.
The fix consists of the following parts:
1) Store the list of timers to fire in a member, so we can cancel things from
that list as needed.
2) To avoid canceling things scheduled by ScheduleWork, remove the CancelTimer
call in ScheduleWork. This does mean we now allow multiple timers for the
same callback+appState in the timer list, if they were created by
ScheduleWork, but that should be OK, since the only reason that pair needs to
be unique is to allow cancellation and we never want to cancel the things
ScheduleWork schedules. As a followup we should stop using the timer list
for ScheduleWork altogether and use ScheduleLambda like LayerImplFreeRTOS
does, but that involves fixing the unit tests that call ScheduleWork without
actually running the platfor manager event loop and expect it to work
somehow.
TestRead was failing the sanity assert for not losing track of timers
to fire, because it was spinning a nested event loop. The changes to
that test stop it from doing that.
Fixesproject-chip/connectedhomeip#19387Fixesproject-chip/connectedhomeip#22160
* Add a unit test that timer cancelling works even for currently "in progress" timers
* Address review comments.
* Fix shadowing problem.
* Turn off TestSystemScheduleWork on esp32 QEMU for now.
* Turn off TestSystemScheduleWork on the fake platform too.
The fake platform's event loop does not actually process the SystemLayer events.
Co-authored-by: Andrei Litvin <[email protected]>
0 commit comments