Skip to content

Kernel timeout API does not document well accepted values #20438

@nordic-krch

Description

@nordic-krch

Describe the bug
Timeout (and sleep) API has s32_t type but it expects that timeout will be non-negative (or K_FOREVER defined as -1). Argument documentation does not specify that which may lead to confusion as user may expect that negative values will be treated as the past and timeout will expire immediately.

Example of that false assumption here:

k_sleep(__ticks_to_ms(ticks - ticks_elapsed));

Expected behavior
API should clarify that even though arguments are s32_t only non-negative values are accepted (or specials).

Metadata

Metadata

Assignees

Labels

area: KernelbugThe issue is a bug, or the PR is fixing a bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions