Skip to content

Instantly share code, notes, and snippets.

@imbriaco
Created November 14, 2008 15:56
Show Gist options
  • Save imbriaco/24956 to your computer and use it in GitHub Desktop.
Save imbriaco/24956 to your computer and use it in GitHub Desktop.
start(AnAtom, Fun) ->
case global:set_lock({funLock, AnAtom}, [node()], 0) of
true ->
Pid = spawn(Fun),
global:register_name(AnAtom, Pid);
false ->
{error, "Function already registered."}
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment