Or you can use a monitor (erlang:monitor/2), to receive a message when a process dies.<br>Or you can check if a proces is alive with: erlang:is_process_alive(PID)<br><br><br>Sergej<br><br><div class="gmail_quote">On Tue, Dec 9, 2008 at 7:40 AM, Bernard Duggan <span dir="ltr"><<a href="mailto:bernie@m5net.com">bernie@m5net.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">Jack Orenstein wrote:<br>
> On Dec 9, 2008, at 12:58 AM, Rapsey wrote:<br>
><br>
><br>
>> Using the send operator is very common. To avoid endless waiting in<br>
>> a receive statement you can use after:<br>
>><br>
>> receive<br>
>>         {Server, Response} -><br>
>>             ?DUMP({send_and_receive, received, Response}),<br>
>>             Response<br>
>>        after 1000 -><br>
>>              void<br>
>>   end.<br>
>><br>
><br>
> But this won't distinguish a dead process from a slow one.<br>
><br>
</div></div>If you want to ensure the process is running, you can use<br>
process_flag(trap_exit, true),<br>
and then spawn_link(), instead of spawn() to create the server process.<br>
Then, in your receive block above add a pattern<br>
<br>
{'EXIT', Server, Reason}<br>
<br>
This will be sent to you when the server process exits for whatever reason.<br>
<br>
Cheers,<br>
<font color="#888888"><br>
Bernard<br>
</font></blockquote></div><br>