[erlang-questions] embedded timeouts
Mon Jul 5 11:22:40 CEST 2010
> Hi all,
> Why the first timeout never happens ?
Does the function in init/1 receive a message?
If it does, and loop/1 is called, it is no longer inside
the receive clause, and the 'after' clause will not
execute (it simply means, do this if no message has arrived
within Timeout milliseconds).
If no message is sent to the receive clause in init/1,
loop() will never be called.
> How must be structured this code in order to have two timeouts ?
> after Timeout ->
> receive after 1000 -> 0 end
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd
More information about the erlang-questions