[erlang-questions] Programming question

Mats Cronqvist <>
Wed Jan 24 14:42:27 CET 2007


Sean Hinde wrote:
> Hi,
> 
> A quick question for Erlang gurus out there.
> 
> I have two processes A and B. B spends most of its life in a series  
> of gen_server calls towards A:
> 
> loopB(PidA, S) ->
>       Res = gen_server:call(PidA, {op, stuff}),
>       S1 = process(Res, S),
>       loopB(PidA, S1).
> 
> The question is how do I set things up so that if A dies B is killed?


  as a non-guru, i was thinking that happened automatically as soon as you made 
the call?

1> is_process_alive(Pid).
false
2> gen_server:call(Pid, {op, stuff}).
** exited: {noproc,{gen_server,call,[<0.14604.0>,{op,stuff}]}} **

   or is that too late?

   mats



More information about the erlang-questions mailing list