ensure_started

Ulf Wiger <>
Mon Mar 24 09:37:36 CET 2003


On Mon, 24 Mar 2003, Vladimir Sekissov wrote:

>Good day,
>
>cpressey> >      after 0 -> % nobody wants to talk to me
>cpressey>
>cpressey> Is there a guarantee that you won't get a message right here?
>
>From "Concurent Programming in Erlang" p.76:
>
>	A timeout of 0 means that the timeout will occur immediately,
>	but the system tries all messages currently in the mailbox first
>
>If your mailbox is empty you haven't time to receive any
>other message if you exit immediately.
>
>I believe that mailbox scanning is atomic operation. There
>were some explanations in this list how system changes
>management policy for processes with huge mailboxes.

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