Your own behaviours

Chandrashekhar Mullaparthi <>
Sun Sep 30 21:28:11 CEST 2001


I'll go thru the code for these modules and study them. Thanks! But I
suppose you can do more than just start the top level supervisor in the
"top" module. You can have code to do different things in different
application start phases for example.

cheers,
Chandru

> -----Original Message-----
> From: Vance Shipley [mailto:]
> Sent: 27 September 2001 13:51
> To: Chandrashekhar Mullaparthi
> Cc: 
> Subject: RE: Your own behaviours
> 
> 
> Chandru,
> 
> This is an issue I have visited before.  The first time we packaged
> an "application" I found it odd that the top module, having behaviour
> application, did pretty much nothing but start top level supervisor
> which was implemented in another module.  I wondered why the 
> supervisor
> couldn't also be the application master.  Looking at the callbacks 
> which the two behaviours have I saw no conflict.  Then I looked at
> OTP for examples and that is just what I found.  Some notable modules
> which behave as both supervisor and application master are kernel
> and sasl.
> 
> Here is the example from kernel.erl:
> 
> 	-module(kernel).
> 	
> 	-behaviour(application).
> 	-behaviour(supervisor).
> 
> 
> I wrote a shell script to find all examples (included below) and
> here is the list from R7B-3:
> 
> ./lib/sasl/src/sasl.erl
> ./lib/kernel/src/kernel.erl
> ./lib/mnesia/src/mnesia_event.erl
> ./lib/mnesia/src/mnesia_sup.erl
> ./lib/mnemosyne/src/mnemosyne_sup.erl
> ./lib/mnesia_session/src/mnesia_session_top_sup.erl
> 
> 
> 	-Vance
> 
> Vance Shipley
> Motivity Telecom Inc.
> +1 519 579 5816
> 
> 
> find_multiple_behaviours.sh:
> #! /bin/sh
> for i in `find . -name "*.erl"`
> do
>         if [ `fgrep -c "behaviour(" $i` -gt 1 ] 
>         then  
>                 echo $i
>         fi
> done
> 



NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.




More information about the erlang-questions mailing list