kernel: timeout: ensure next timeout is set when aborting the first timeout
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 <dong.d.wang@intel.com>
This commit is contained in:
parent
6ba0563fe2
commit
dd5f11cb04
1 changed files with 5 additions and 0 deletions
|
|
@ -147,8 +147,13 @@ int z_abort_timeout(struct _timeout *to)
|
||||||
|
|
||||||
K_SPINLOCK(&timeout_lock) {
|
K_SPINLOCK(&timeout_lock) {
|
||||||
if (sys_dnode_is_linked(&to->node)) {
|
if (sys_dnode_is_linked(&to->node)) {
|
||||||
|
bool is_first = (to == first());
|
||||||
|
|
||||||
remove_timeout(to);
|
remove_timeout(to);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
if (is_first) {
|
||||||
|
sys_clock_set_timeout(next_timeout(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue