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

Re: [PATCH] Adding callbacks to the core

Thread Previous | Thread Next
David M. Lloyd
August 22, 2001 05:56
Re: [PATCH] Adding callbacks to the core
Message ID:
On Wed, 22 Aug 2001, Arthur Bergman wrote:

> Benchmarks benchmarks benchmarks benchmarks.

I changed the code to share the async check with signals; therefore there
will be no speed difference in the default case.  However, I will do some
benchmarking anyways just to satify the crowd.

> You need to give the PerlInterpreter to the callback,

Excellent point; thank you.

> > +PERLVARI(Icallback_head, CALLBACK *, NULL)  /* Pointer to first waiting callback */
> > +PERLVARI(Ievent_pending, int, 0)        /* Flag that indicates that an event is pending */
> > +
> > +#if defined(USE_THREADS) || defined(USE_ITHREADS)
> > +PERLVAR(Icallback_mutex, perl_mutex) /* Mutex for adding callbacks in a threadsafe manner */
> > +#endif
> Under ithreads, the callbacks are by interpreter, hence there is no
> need to lock the list of callbacks.

The mutex is not for the sake of ithreads OR 5005threads.  The mutex is
there so an XS module can launch a thread and have a clean way to
resynchronize.  If it were possible, I'd use the mutex even if Perl wasn't
compiled to use threads.

> However there is a need to add the relevant code to sv.c:perl_clone to
> properly duplicate the callback structure. I suspect the best would be
> just to copy all the structs and let the callback be aware of under
> what perl interpreter it was called.

OK, I'll add that too. Mr. Ing-Simmons wants me to resubmit the patch so
I'll include these two things as well.

- D


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About