develooper Front page | perl.perl5.porters | Postings from July 2001

Re: Asynchronous callbacks from C

Thread Previous | Thread Next
From:
David M. Lloyd
Date:
July 6, 2001 23:32
Subject:
Re: Asynchronous callbacks from C
Message ID:
Pine.LNX.4.21.0107070123140.20049-100000@homebody.freemm.org
On Sat, 7 Jul 2001, Paul Johnson wrote:

> On Thu, Jul 05, 2001 at 01:16:31PM -0500, David M. Lloyd wrote:
> > On Thu, 5 Jul 2001, Paul Johnson wrote:
> > > What is data in each of these cases?
> > 
> > You would set 'data' in 'enable_callback', and then when the loop comes
> > 'round, 'data' would be passed to (*callback) as the first parameter.  
> > That way you can pass data to your callback.
> 
> OK, I thought as much, but I'm a little confused by your interface.
> 
> Does add_callback call enable_callback?  If so it requires a data
> parameter.  If not it doesn't require enable_cb.  (Unless I
> misunderstand enable_cb.)

You're right there; enable_cb is not necessary.
 
> Should there be a disable_callback?  Maybe enable_callback isn't even
> needed?  You could just work with add and delete.

My vague theory was that when a callback is triggered, it is then
disabled.  I suppose it makes more sense to have an 'on' function (that
would be called by an asynchronous event maybe) and an 'off' function
(maybe triggered in the callback itself, or maybe not at all).

> You are expecting the callbacks to be called inbetween every opcode,
> right?  Or were you thinking that after being called the callback would
> become disabled?

Both actually... see above.

- D

<dmlloyd@tds.net>


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About