Hello!
Assuming an OS timer tick interval of 5ms, os_wait() returns exactly after 5ms with the code as follows:
while (1) { os_wait(K_TMO, 1, 0); }
However, with the code like that:
while (1) { os_wait(K_SIG, 255, 0); os_wait(K_TMO, 1, 0); }
the second call to os_wait returns after something beetween 0 and 5ms.
I have read somewhere that os_wait(K_TMO, 1, 0) only waits until the next timer tick but why only in the second case?
Regards, Markus
Yes, I meant one ms. If the timer isn't synchronized, a one ms delay may end immediately just as well as after one ms.
Many OS runs their system clock at a higher resolution than the task time-slice frequency, so that a thread that forces a task switch after 95% of the slice time will not result in the following task only getting the remaining 5% of the task slice.