[erlang-questions] question re parallel map code on pg 366 of "Programming Erlang"

Bjorn Gustavsson <>
Thu Jan 22 07:27:17 CET 2009


On Thu, Jan 22, 2009 at 4:51 AM, David Cabana <> wrote:
> If the computation of F(H) raises an exception, presumably it would do
> so whether F was called by
> map or by pmap. Why catch the exception in the one case but not the other?
> Why is it important that pmap terminate normally, but not so that map
> terminate normally?

Because the exception happens in another process. If one of the worker
processes dies and does not deliver a result, the main process (the one
calling pmap/2) would hang forever in the gather/2 function.

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list