[erlang-questions] Erlang Scheduler for Recurring Events

Kostis Sagonas kostis@REDACTED
Thu Aug 25 10:32:25 CEST 2011


On 08/24/11 17:51, Ladislav Lenart wrote:
> Hello.
>
>  > I was told that the timeout=0 reply from init/1 is has some implicit
>  > behavior that might be useful: it ensures that the
>  > handle_info('timout', State) is called before any other messages can
>  > be dispatched, which gives you a hook from init/1 that will run after
>  > the call to gen_server:start_link has returned. Feels hacky, to me --
>  > but the only way to handle certain cases.
>
> Just a side note to the special meaning of timeout=0 in init: the same
> applies to any message sent to self() from the init/1 function, because
> noone else knows my pid yet.

Interesting...

But would you care to elaborate a bit?  What do you mean "noone else 
knows my pid yet" in an SMP environment with multiple schedulers and in 
the presence of the processes() function that can be called from 
anywhere?  Am I missing something?

Kostis



More information about the erlang-questions mailing list