Skip to content

Commit 4ce908a

Browse files
Andy Rosscarlescufi
Andy Ross
authored andcommitted
[nrf fromtree] kernel/timeout: Schedule zero-time timeouts
Fix an edge case that snuck in with the recent fix: if timeslicing is enabled, the CPU's slice_ticks will be zero, and thus match a timeout object's dticks value of zero, and thus get suppressed (because "we already have a timeout scheduled for that") incorrectly. Fixes #31789 Signed-off-by: Andy Ross <[email protected]>
1 parent e81a613 commit 4ce908a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/timeout.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ void z_add_timeout(struct _timeout *to, _timeout_func_t fn,
134134
*/
135135
int32_t next_time = next_timeout();
136136

137-
if (_current_cpu->slice_ticks != next_time) {
137+
if (next_time == 0 ||
138+
_current_cpu->slice_ticks != next_time) {
138139
z_clock_set_timeout(next_time, false);
139140
}
140141
#else

0 commit comments

Comments
 (0)