On Thu, Jul 05, 2001 at 09:39:33AM -0500, David M. Lloyd wrote: > On Thu, 5 Jul 2001, Paul Johnson wrote: > > > On Thu, Jul 05, 2001 at 08:42:52AM -0500, David M. Lloyd wrote: > > > > > Exactly what is a plugable runops function? Is that something that exists > > > in perl today (5.6)? Is there an API interface to it? > > > > It is a feature that Malcolm added when he first started on the compiler > > stuff, if I remember correctly. > ><snip> > > > > Its actually fairly simple, you write your own runops function and tell > > Perl to use it. See Cover.xs in Devel::Cover for a working example. > > OK, I see how it works, and it seems simple. However, it seems that only > one thing can be using the runops deal at a time. Also, would using this > method invalidate -DDEBUGGING? You're quite right about only one module being able to use it at a time. It works fine with -DDEBUGGING, but of course you'll need the DEBUGGING code from Perl_runops_debug() in your runops if you want to use it. > Maybe what I should do is make an XS module that makes a generic callback > interface available to other modules by keeping a linked list of > callbacks... that may be something that other people can use too. > > I guess what I'd do is make a few functions available from the module: > > /* Returns a 'handle' that can be used to remove a callback */ > int add_callback(void (*callback)(void *data), int enable_cb); > > /* Remove a callback from the list */ > void remove_callback(int handle); > > /* Set's the 'enable' flag so that a callback is called at next > opportunity (this function would be async-safe */ > void enable_callback(int handle, void *data); What is data in each of these cases? -- Paul Johnson - paul@pjcj.net http://www.pjcj.netThread Previous | Thread Next