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
The callback_timer_locked, callback_timer_atomic and callback_timer_interrupt is restarting the timer automatically after the callback is handled for repeating timers. If inside the callback the period is changed the timer is stopped, so normally you should call a start timer to start it again. When doing this from within in the callback, the timer is inserted twice in the list and a circular reference is created in the linked list.
The superseded callback_timer doesn't have this problem as there the timer is inserted before the callback is called. I see this behavior is changed 2 years ago in the other versions. Can you remember what the rationale for this change was?
Maybe changing the period inside the callback for a repeating timer is not intended, but this is not documented. Also it's not possible to stop a timer in the callback as it will be started automatically after the call back.
The easiest fix, I think, is to skip the automatic insert if the timer.is_active() is set, as normally it not possible to do an insert twice.
Moving the insert back is not a real option I think as this gives totally different behavior for existing code.
Thanks in advance
The text was updated successfully, but these errors were encountered:
The superseded callback_timer doesn't have this problem as there the timer is inserted before the callback is called. I see this behavior is changed 2 years ago in the other versions. Can you remember what the rationale for this change was?
@jwellbelove Can you perhaps shed a light on this?
The callback_timer_locked, callback_timer_atomic and callback_timer_interrupt is restarting the timer automatically after the callback is handled for repeating timers. If inside the callback the period is changed the timer is stopped, so normally you should call a start timer to start it again. When doing this from within in the callback, the timer is inserted twice in the list and a circular reference is created in the linked list.
The superseded callback_timer doesn't have this problem as there the timer is inserted before the callback is called. I see this behavior is changed 2 years ago in the other versions. Can you remember what the rationale for this change was?
Maybe changing the period inside the callback for a repeating timer is not intended, but this is not documented. Also it's not possible to stop a timer in the callback as it will be started automatically after the call back.
The easiest fix, I think, is to skip the automatic insert if the timer.is_active() is set, as normally it not possible to do an insert twice.
Moving the insert back is not a real option I think as this gives totally different behavior for existing code.
Thanks in advance
The text was updated successfully, but these errors were encountered: