About the Handler in gen_event

Sean Hinde Sean.Hinde@REDACTED
Mon Feb 24 14:21:41 CET 2003


> Hi have tested this module implementing gen_event,
> When an event is notified to the event_mgr, it  is not
> handled, 
> Even i started sasl also,
>  
> the gen_event:add_handler is success i.e callback
> function init(_) is called. 
> but when an event is notified gen_event:notify is
> called the callback function handle_event is not
> called
> 
> what may the problem?
> Just please have a look at this module attached,

It will help if your init function returns {ok, State} where State is what
you wish to be passed into the State variable of your callbacks (I just
added [] - so it is {ok, []}).

You also then have a bug in your io:format statements - the 2nd arg must be
a list

After this it works. congratulations!

Sean



 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