Doc or gen_event:notify/2 Error!

Ulf Wiger (ÄL2/EAB) ulf.wiger@REDACTED
Thu Sep 11 09:32:46 CEST 2003


From: Martin J. Logan [mailto:mlogan@REDACTED]
> Calls with a timeout are necessarily synchronous. I am just 
> wondering if asynchronous casts and messages should have the
> same behaviour. Should an unregistered_name ! msg really cause
> an exit? Is this something to "let it die" over? Is not
> the true spirit of asynchronous messaging just send and pray? 

Actually, an earlier OTP release changed this behaviour, so that
RegName ! msg had the same semantics as Pid ! msg. This was more
consistent, but could cause some really nasty bugs in legacy code.
The behaviour was then reversed, and the discussions triggered
by the whole thing eventually led to the introduction of the 
monitor() BIF.(*)

/Uffe

(*) This step may not be obvious. One of the important uses of 
RegName ! Msg was to get early detection in the most common cases
where the process at the other end were down. This was not a 
watertight solution, but improved the behaviour overall. The 
problem to be solved was how to do reliable detection of such
faults in a synchronous dialogue without always having to rely
on the timeout (which has to be dimensioned for the worst "legal"
case in order to avoid false timeouts.) Timeouts were needed,
but not the whole solution. Links were two-way (not what we 
wanted), and not stackable (difficult to know when to unlink).
Enter monitor(), which is one-way and stackable, so that we
can turn it on locally in e.g. a gen:call() without disturbing
anything else, and getting reliable early detection if the 
other process fails.



More information about the erlang-questions mailing list