You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Charles Ying <cy...@sendmail.com> on 2000/07/10 23:33:58 UTC

running code references in different interpreter contexts...

In a module I'm writing for 5.6.0 and ithreads, I've got this code that
does rudimentary interpreter pools, ala perl_clone()....

Unfortunately, if I try to call_sv on a code reference from the parent
interpreter in one of the child interpreters, the routine gets no
arguments and upon a second invocation of that routine, perl decides to
segfault on me. :)

Now, having function names as strings works fine, since a get_cv is made
from call_sv which gets the appropriate "magic" from the child interpreter
to make things work right. But I want to support actual code references,
since my users might want to pass in code references instead of strings
with function names.

I read dougm's comments on this in modperl_callback(), which say that
under ithreads, each handler needs to get_cv() from the selected
interpreter so the proper CvPADLIST is used.

I dug around for something that might do it, and found an undocumented
Perl_sv_dup, which duplicated SVs with their CvPADLISTs (if the values are
CVs). I tried that, and everything "worked"... The thing is, I don't know
if this is the right thing to do...

Thoughts?

-- Charles