develooper Front page | perl.perl5.porters | Postings from February 2003

Re: thread safe

Thread Previous | Thread Next
From:
A . Bergman
Date:
February 2, 2003 15:24
Subject:
Re: thread safe
Message ID:
E8B991FA-36EF-11D7-85CC-003065D64CBE@nanisky.com

On söndag, feb 2, 2003, at 21:22 Europe/Stockholm, Brandon Willis wrote:

> Arthur,
>
> I don't see how creating many PerlInterpreter*'s will help as calls 
> like
> get_sv and the rest do not take in a PerlInterpreter* and thus would
> have no way of knowing which PerlInterpreter I meant them to act on.
>
> I must be missing a piece of information.  Do the internal calls 
> somehow
> "know" that they are to act on one PerlInterpreter versus another? If
> not how do I tell them "Hey you get_sv work on PerlInterpreter A."?
>
> If I cannot give internal calls context then really I think my only
> option is to learn how to spawn ithreads directly from C.
>
> Thanks,
> --Brandon

Hi, what happens is that all your get_sv gets translated to
Perl_get_sv(aTHX_

where aTHX is a argumentTHreadconteXt object which is the perl 
interpreter, it lives in
a thread local key, and when creating a new perl interpreter that is set

Good way is to read the source code for threads.xs to see how it does 
it, basicly the
two macrost  PERL_SET_CONTEXT(PerlInterpreter*) and PERL_GET_CONTEXT.

Arthur


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