process sleeps

(Yani Dzhurov) writes:
If you read the source code for timer.erl:
sleep(T) ->
receive
after T -> ok
end.
you will see that timer:sleep(0) will become
receive after 0 -> ok end.
and that will not even schedule out the current process.
To do that you should use
erlang:yield().
instead.
> Hi guys,
>>>> I wondered whether timer:sleep(0) would cause a process to sleep or it will
> just pass it ?
>> For instance if I have spawned process with fun();
>>>> fun()->
>> bar(),
>> baz(),
>> timer:sleep(0),
>> bar().
>> Would the process sleep after baz(), or not ?
>>>> 10x,
>>>> yani
>>
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB