kernel: k_sleep: fix return value for absolute timeout
Fixes calculation of remaining ticks returned from z_tick_sleep so that it takes absolute timeouts into account. Fixes #32506 Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
This commit is contained in:
parent
5b8d418058
commit
4c85b4606b
1 changed files with 5 additions and 2 deletions
|
@ -1227,8 +1227,11 @@ static int32_t z_tick_sleep(k_ticks_t ticks)
|
||||||
}
|
}
|
||||||
|
|
||||||
k_timeout_t timeout = Z_TIMEOUT_TICKS(ticks);
|
k_timeout_t timeout = Z_TIMEOUT_TICKS(ticks);
|
||||||
|
if (Z_TICK_ABS(ticks) <= 0) {
|
||||||
expected_wakeup_ticks = ticks + sys_clock_tick_get_32();
|
expected_wakeup_ticks = ticks + sys_clock_tick_get_32();
|
||||||
|
} else {
|
||||||
|
expected_wakeup_ticks = Z_TICK_ABS(ticks);
|
||||||
|
}
|
||||||
|
|
||||||
k_spinlock_key_t key = k_spin_lock(&sched_spinlock);
|
k_spinlock_key_t key = k_spin_lock(&sched_spinlock);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue