[erlang-questions] spawn race condition?

Anthony Shipman als@REDACTED
Tue Apr 3 19:01:16 CEST 2007


I have code that looks like this:

call(Phone) ->
    Pid = spawn(?MODULE, init, [Phone]),

    util:delay(100),
    Pid! {startCall, self()},
    receive
	callComplete -> {ok, Pid}
    after
	5000 -> false
    end.

If I don't have the 100ms delay then the only message that the new process 
receives is the integer 0. It works with the delay. Am I missing something?
-- 
Anthony Shipman                    Mamas don't let your babies 
als@REDACTED                   grow up to be outsourced.



More information about the erlang-questions mailing list