ensure_started
Ulf Wiger
etxuwig@REDACTED
Mon Mar 24 17:59:03 CET 2003
On Mon, 24 Mar 2003, Chris Pressey wrote:
>I was also operating under the assumption that the
>following would, generally speaking, fail:
>
> list_to_pid("<0.400.0>") ! foo.
>
>Trying it from the shell, it doesn't, foo just goes into a
>black hole presumably. (now I better understand why some
>people use the phrase "send and pray")
However, reg_name ! foo _will_ fail if there is no process
registered as 'reg_name'.
>I guess the lesson to take from this is that it's good
>coding style to always use a finite timeout when waiting
>for a reply from something you're not linked to, because
>that reply simply may never show up no matter how carefully
>you code the server... ?
Oh yes. (:
Actually, monitors take care of the cases where the server
dies before responding, but there are other cases where a
timeout is really needed. Deadlocks due to rare combinations
of events is one such occasion. Finite timeouts give a
rather clear indication that something is not quite right.
/Uffe
--
Ulf Wiger, Senior Specialist,
/ / / Architecture & Design of Carrier-Class Software
/ / / Strategic Product & System Management
/ / / Ericsson AB, Connectivity and Control Nodes
More information about the erlang-questions
mailing list