zephyr/doc/kernel/services
Nicolas Pitre 52e2f83185 kernel/timeout: introduce the timepoint API
This is meant as a substitute for sys_clock_timeout_end_calc()

Current sys_clock_timeout_end_calc() usage opens up many bug
possibilities due to the actual timeout evaluation's open-coded nature.

Issue ##50611 is one example.

- Some users store the returned value in a signed variable, others in
  an unsigned one, making the comparison with UINT64_MAX (corresponding
  to K_FOREVER) wrong in the signed case.

- Some users compute the difference and store that in a signed variable
  to compare against 0 which still doesn't work with K_FOREVER. And when
  this difference is used as a timeout argument then the K_FOREVER
  nature of the timeout is lost.

- Some users complexify their code by special-casing K_NO_WAIT and
  K_FOREVER inline which is bad for both code readability and binary
  size.

Let's introduce a better abstraction to deal with absolute timepoints
with an opaque type to be used with a well-defined API.
The word "timeout" was avoided in the naming on purpose as the timeout
namespace is quite crowded already and it is preferable to make a
distinction between relative time periods (timeouts) and absolute time
values (timepoints).

A few stacks are also adjusted as they were too tight on X86.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-25 09:12:26 +02:00
..
data_passing doc: Update FIFO and LIFO documentation 2023-05-02 04:43:08 -04:00
other riscv: improve FPU sharing documentation 2023-02-18 01:09:16 +09:00
scheduling doc: Switch main return type from void to int. 2023-04-14 07:49:41 +09:00
smp
synchronization doc: Switch main return type from void to int. 2023-04-14 07:49:41 +09:00
threads doc: kernel: update thread priorities diagram 2023-06-23 14:27:22 -04:00
timing kernel/timeout: introduce the timepoint API 2023-07-25 09:12:26 +02:00
index.rst doc: Correct msgq data item size discrepancy 2023-06-21 13:57:15 -04:00
interrupts.rst
polling.rst doc: polling: Fix semaphore contested description 2022-10-04 10:36:45 +02:00