develooper Front page | perl.ithreads | Postings from November 2009

Sharing scalars (data) between cloned and main interepreter instances

From:
Sri
Date:
November 24, 2009 00:04
Subject:
Sharing scalars (data) between cloned and main interepreter instances
Message ID:
312875.88387.qm@web56502.mail.re3.yahoo.com
Hello,

I havent found any relevant posts on this topic so far, so hoping the experts can rescue me.

I'm extending Perl and also embedding a cloned interpreter.  I use the cloned interpreter to invoke Perl sub's as callbacks.  The callback part is working fine.  However, the value of a variable changed in the callback subroutine is NOT being reflected in the rest of the perl script.

I tried to "use threads:shared" and ":shared" the variable in question, but perl exits, complaining that another completely unrelated scalar is "Invalid value for shared scalar at".  Why this msg when that is not declared as ":shared"?

More importatnly, How can I "share" variable updates between the main perl script and the callbacks invokved thru the cloned interpreter?

I'm using v5.8.8 perl.  perl_clone() is using CLONEf_COPY_STACKS | CLONEf_KEEP_PTR_TABLE.  The perl sub is sv_dup() with the same flags in CLONE_PARAMS before call_sv().

Please see this post that describes my current code.

http://markmail.org/thread/cjbhybjfikuirvud

Thanks



      



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