how "synchronous" is exit?

Richard Carlsson <>
Tue May 30 08:58:22 CEST 2006


Damien Katz wrote:
> When issuing an exit(Pid, kill) to a another process,
> is there any guarantee that the process, and all its
> linked child processes, are dead before continuing?

No. Signals (exit/2 sends a signal) are asynchronous, just
like messages. In fact, messages are a special case of signals.

> If not, can anyone tell me a good way to wait on a
> process tree to die before continuing an action?

Either using old-school bidirectional process links and
setting the trap_exit process flag in the watching process,
or the more modern, unidirectional process monitors. See
http://www.erlang.org/doc/doc-5.5/lib/kernel-2.11/doc/html/erlang.html
and http://www.erlang.org/doc/doc-5.5/doc/reference_manual/processes.html#10.6
(sections 10.6-10.8) for details.

	/Richard




More information about the erlang-questions mailing list