ensure_started

Ulf Wiger <>
Sun Mar 23 21:42:47 CET 2003


On Sun, 23 Mar 2003, Chris Pressey wrote:

>I was wondering if there's a similar case when a process
>dies.  Is there a way to absolutely ensure that a
>process'es mailbox is empty before it dies?  Especially if
>more than one process is sending messages to the process.

The mdisp contrib has a pattern for this. The simplest way
to check from the outside if a process has any messages
pending is process_info(P, message_queue_len), which
returns the length of P's message queue.

The mdisp 'sleep' protocol was designed to handle the
killing of temporary threads without losing any messages,
and without consuming any messages detected during the
'sleep' negotiation. That last one may be of minor
importance, but I think that the administrative code should
leave it to the programmer to receive his own messages.


/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