How delay() works ?

How delay() works ?

It has for(;:wink: countdown loop or it creates timer & wait in Receive() ?

creates timer and Receive(), also nanosleep() does that … so its not nano but ticksize at best

It doesn’t use Receive(). If you look at the state of the process when it’s “sleeping” the state is REPLY block on Proc32.

From what I can tell delay is using an undocumented feature of set_timer() that makes it block and only return when the timer expire. It seems that by calling timer_settime with the flag argument set to 0 will cause that behavior.

Basicaly timer_settime sends a _PROC_TIMER message to Proc to but Proc will only reply when the timer expires. That is why the program is in REPLY state.

yea, sorry my mistake, Mario is right
it calls timer_create and timer_settime which blocks until expiration