Spawning processes

Vlad Dumitrescu (EAW) <>
Fri Feb 14 11:41:42 CET 2003


Hi,

Since it's friday, I hope I may be excused if I just don't see the obvious. Please point it out to me! :-)

I need to have a named process available at all times. The solution I came up with is to have each interface function do something like
    Pid = start(),
    Pid ! Msg
where start() checks if there is a process registered, and if not starts it and registers; otherwise the current Pid is returned. This works fine, until one tries to do several calls in a row to an unexisting process: all try to start and register the server, because the registration doesn't have time to do it's job...

Is there another way to do something like this? I need to introduce this in a working system and don't know from which process it will be called first, and also have no control over the startup order...

Thanks in advance. Regards,
Vlad



More information about the erlang-questions mailing list