Preventing multiple instances through register/2

Richard Carlsson <>
Sun May 14 19:38:20 CEST 2006


Jeff Crane wrote:
> 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) ? 

Let the spawned process try to register itself, or exit if
it does not succeed. In either case, send a message to the
(waiting) parent process, informing it of the outcome,
before terminating or getting on with the real work.

	/Richard


-- 
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham



More information about the erlang-questions mailing list