Preventing multiple instances through register/2
Jeff Crane
jefcrane@REDACTED
Sun May 14 18:59:54 CEST 2006
%%Start gen_server()
start()->
%% greeting msg
io:format(" Started test_server on:~p~n",[self()]),
%% read user/pass
case(
catch register(test_server,spawn(?MODULE,
load_accounts, []))
) of
{'EXIT', _} ->
already_started;
Pid ->
ok
end.
---
Yes it gets caught, but it also still spawns! What's
the proper way to prevent a duplicate spawn if not
through case catch register(spawn) ?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the erlang-questions
mailing list