-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
The z_clock_announce() unconditionally adjust dticks of first timeout in the list:
if (first() != NULL) {
first()->dticks -= announce_remaining;
}
However this adjustment is not always valid:
-
If the adjusted timeout was on the list before call to
z_clock_announce(), we have to do such correction in order to not delay next timeout. -
If the adjusted timeout belongs to periodic k_timer which was handled during current
z_clock_announce()execution, we should do such correction if we would like to not accumulate error. -
If the adjusted timeout was added during current
z_clock_announce()execution but it is not related periodic timer which was handled, we have to skip the adjustment. If we perform it, the newly scheduled timeout will fire earlier than expected.
This issue has been initially mentioned in #11722.
Affected use case is presented here: #12247 (comment)