Skip to content

k_sleep: Invalid return value when using absolute timeout. #32506

@micwurm

Description

@micwurm

When invoking k_sleep() with an absolute timeout, the return value is garbage.

	retVal = k_sleep(K_TIMEOUT_ABS_TICKS(targetTicks));
	endTicks = k_uptime_ticks();

In the end, targetTicks == endTicks (as expected), but retVal != 0 (should be 0).
See also: #32499
The problem is that z_tick_sleep() doesn't handle the case of absolute timeouts when computing expected_wakeup_ticks.
(Maybe z_add_timeout() should return ticks to avoid duplication?)

Metadata

Metadata

Labels

area: KernelbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions