<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff size=2>Hi
Suresh,</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff size=2>You
only need one handler and one module, regardless of the number of
events.</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2>Gen_event works such that for each incoming event, the function
handle_event(Event, State)</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff size=2>is
called in every installed event handler. Thus, each event handler can choose to
match</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff size=2>on
every event that comes in, or perhaps only on one or a few. It's of course
important</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff size=2>to
have a catch-all clause, so that the handler doesn't crash if a new event is
introduced.</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff size=2>The
only real point to having several different event handler modules is if you have
</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2>several different _types_ of event handler. Multiple instances could for
example be </FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff size=2>used
if you have an event handler that filters events and sends messages to a
worker</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2>process; the worker process could then install and supervise its own
instance of a </FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2>generic handler.</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2>Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=858103508-22102004><FONT face=Arial color=#0000ff
size=2>Uffe</FONT></SPAN></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
owner-erlang-questions@erlang.org
[mailto:owner-erlang-questions@erlang.org]<B>On Behalf Of </B>suresh
saragadam<BR><B>Sent:</B> den 21 oktober 2004 05:41<BR><B>To:</B>
Erlang<BR><B>Subject:</B> How to make use of gen_event
behaviour<BR><BR></FONT></DIV>
<DIV>Hi</DIV>
<DIV> </DIV>
<DIV>A small clarification about gen_event behaviour, </DIV>
<DIV> </DIV>
<DIV>For suppose i have 25 different events to be handled, </DIV>
<DIV> </DIV>
<DIV>If i am implementing gen_event behaviour, i should have 1 event
manager,</DIV>
<DIV> </DIV>
<DIV>and 25 event handlers,</DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV>As event handler is implemented as a callback module, </DIV>
<DIV> </DIV>
<DIV>I should have 25 callback modules. </DIV>
<DIV> </DIV>
<DIV>When ever an event occurs particular event handler is called as a call
back module</DIV>
<DIV> </DIV>
<DIV>am i correct</DIV>
<DIV> </DIV>
<DIV>if i have '100 events' i should have '100 event handlers' implemented as
call back modules</DIV>
<DIV>i.e '100 moudles' (each one for one event)</DIV>
<DIV> </DIV>
<DIV>sureshsaragadam</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<P>
<HR SIZE=1>
Do you Yahoo!?<BR><A href="http://vote.yahoo.com">vote.yahoo.com</A> -
Register online to vote today!</BLOCKQUOTE></BODY></HTML>