start or re-start?

Wiger Ulf ulf.wiger@REDACTED
Fri Jul 25 00:07:40 CEST 2003


A fairly simple solution is to create a named ets table in the
start function (before spawning the child), and then writing
something, perhaps a counter, in it in the child's init function.
Since the table is created before spawning the child, it will be
owned by the supervisor, and survive a child restart.

I don't know if it qualifies as a clean solution.

I once wrote a version of supervisor.erl that allowed the child
to recall a history of restarts, including finding out about
escalated restarts. It didn't make it into OTP, perhaps partly
because few people could imagine a pressing need for it.

/Uffe

----- Original Message -----
From: "Luca Manai (ÄV/EAB)" <luca.manai@REDACTED>
To: <erlang-questions@REDACTED>
Sent: den 24 juli 2003 12:29
Subject: start or re-start?


> Hello all,
>
> is there the possibility for a child process to distiguish between
> the two following situations?
>
>   [1] the supervisor has started the child for the first time
>       (start_child/2 interface)
>
>   [2] the supervisor has re-started the child
>       (child process crash)
>
> I couldn't come up up with a clean solution...
> (I don't need to distiguish the restart_child/2 situation)
>
> Thanks.
>
> Luca.
> --
>   Luca Manai           mailto:luca.manai@REDACTED
>
>   ERICSSON AB    -    PDU IP Connectivity and Control
>   Götalandsvägen, 230   -    SE-12544 Älvsjö - Sweden
>   Tel. +46 (0)8 71 94071   -   Fax. +46 (0)8 71 99940




More information about the erlang-questions mailing list