ensure_started

Chris Pressey cpressey@REDACTED
Mon Mar 24 17:45:50 CET 2003


On Mon, 24 Mar 2003 09:37:36 +0100 (MET)
Ulf Wiger <etxuwig@REDACTED> wrote:

> Mailbox scanning is an atomic operation, yes, but there is
> of course still a chance that you will be scheduled out
> before the exit(shutdown).
> 
> In the case of mdisp, this is not considered a problem,
> since the process should only go to sleep in places where
> the next message always comes through mdisp (the rule being:
> it's OK for temporary processes to talk directly to each
> other in transition states, but in stable state, messages
> need to go through the mdisp process; alternatively, all
> messages always go through the mdisp process.)
> 
> /Uffe

My concern, when I pointed that out, was more about the thousands of plain
servers and gen_servers that have been written, although mdisp might
indeed provide some salvation for short-lived processes.

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")

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... ?

-Chris



More information about the erlang-questions mailing list