K_NO_WAIT, K_FOREVER and kernel APIs


Carles Cufi
 

Hi all,

We've had 2 different issues recently coming from the fact that K_NO_WAIT and K_FOREVER do not seem to work with all of the kernel APIs. They are the following:

1) Calling k_timer_start() with K_NO_WAIT, meaning that one desires the timer callback function to be executed as soon as possible. This is useful when one wants to synchronize execution context and start a cyclic timer from the same callback code.

2) Calling k_sleep() with K_FOREVER as a parameter. This looks reasonable to the developer since it simplifies the typical idling loop that one finds in Zephyr using k_cpu_idle(). Instead the kernel returns immediately, which is unexpected.

I think that, due to the fact that both of those issues have confused our kernel API consumers already, we could consider making K_NO_WAIT and K_FOREVER compatible with all of the kernel APIs.

Thoughts?

Thanks,

Carles

Join devel@lists.zephyrproject.org to automatically receive all group messages.