SV: OTP tree doubts

Lennart Öhman Lennart.Ohman@REDACTED
Thu Mar 2 14:13:13 CET 2006


Hi Surindar,
I am  not sure of what you refer to as there being a reference
to a supervisor in for instance gen_server:start_link, but non
in gen_event:start_link. There is infact no reference to the
supervisor in gen_server:start_link either. The relationship
between the supervisor and its newly created child process is
established by the gen_server or gen_event code automatically.
And of course the fact that a client function calling the
start_link function is called from the the supervisor in
questions. A supervisor is made to call the clientfunction
starting the new child by placing it in its children specification.
 
Have you taken a look at the Working with OTP chapters in
the online documentation? There is for instance an example on
how to start an event-manager process using gen_event.
 
http://www.erlang.org/doc/doc-5.4.12/doc/design_principles/part_frame.html
 
Best Regards,
Lennart
 
 
-------------------------------------------------------------
Lennart Ohman                   phone   : +46-8-587 623 27
Sjöland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : lennart.ohman@REDACTED

________________________________

Från: owner-erlang-questions@REDACTED genom Surindar Sivanesan
Skickat: to 2006-03-02 13:56
Till: erlang-questions@REDACTED
Ämne: OTP tree doubts


Hi all,
 
I have some doubts in OTP design.
 
1.In gen_event behaviour, it is mentioned in the document that, start_link() function creates an event manager process as part of a supervision tree.But in that function there is no parameter of supervisor reference. In case of gen_server or gen_fsm behaviour, the start_link function has the supervisor reference as parameter. I'm able to understand gen_fsm and gen_server but gen_event is still confusing. If there is any example applying gen_event, please give me. 
 
2.I can create a thread which continuously running in a loop
 
ex:
-module(sample).
 
start()->
spawn(sample,continuous,[]).

continuous()->
%%Functionality is done here
continuous().
 
whether the same type of thread is implemented as child like gen_fsm, gen_server, gen_event in OTP tree.
 
Please clarify me
-- 
with regards,
S.Surindar 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060302/cf02a2f4/attachment.htm>


More information about the erlang-questions mailing list