Skip to content

Commit d141a61

Browse files
kwd-doodlingrlubos
authored andcommitted
[nrf fromtree] kernel: timeout: ensure next timeout is set when aborting the first timeout
Ref: NCSDK-31290 This ensures that the system clock is correctly updated when the first timeout is aborted, preventing unexpected early wake-up by the system clock programmed previously. Signed-off-by: Dong Wang <[email protected]> (cherry picked from commit dd5f11c) (cherry picked from commit 76a46cb)
1 parent 5237923 commit d141a61

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/timeout.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,13 @@ int z_abort_timeout(struct _timeout *to)
147147

148148
K_SPINLOCK(&timeout_lock) {
149149
if (sys_dnode_is_linked(&to->node)) {
150+
bool is_first = (to == first());
151+
150152
remove_timeout(to);
151153
ret = 0;
154+
if (is_first) {
155+
sys_clock_set_timeout(next_timeout(), false);
156+
}
152157
}
153158
}
154159

0 commit comments

Comments
 (0)