[erlang-questions] Re: erl startup

Wes James <>
Wed Jun 2 03:26:09 CEST 2010


On Tue, Jun 1, 2010 at 6:37 PM, Bernard Duggan <> wrote:
> On 02/06/10 08:43, Wes James wrote:
>>
>> [snip]
>>>
>>> wait_for_exit() ->
>>>        receive
>>>                some_exit_signal ->    ok;
>>>                _ ->    wait_for_exit()
>>>        end.
>>>
>>>
>>
>> If I do this
>>
>>  module:wait_for_exit() ! some_exit_signal.
>>
>> It just hangs.  I have to hit ctrl-c to kill it.  Isn't it supposed to
>> exit wait_for_exit() after that?
>>
>
> ...No?  What you're asking it to do there is to send the message
> 'some_exit_signal' to the process returned by the call
> module:wait_for_exit().  That function doesn't return a process - indeed,
> its whole point is to /not return at all/ until it receives that message.
> You need to get the PID of the process that's running (the value returned by
> start()) and send the signal to that.  ie:
>
> 1> Pid = module:start().
> <some pid>
> 2> Pid ! some_exit_signal.
>
> B
>

Thx again.  That worked.

-wes


More information about the erlang-questions mailing list