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

Re: thread safe

Thread Previous | Thread Next
Colin Watson
February 2, 2003 13:03
Re: thread safe
Message ID:
On Sun, Feb 02, 2003 at 02:22:03PM -0600, Brandon Willis wrote:
> 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.  

Actually, they do. If you look at the prototype of Perl_get_sv() in
perl.c, you'll see:

  Perl_get_sv(pTHX_ const char *name, I32 create)

The pTHX_ there is a context argument used when perl is compiled with
certain options to tell the internal functions what PerlInterpreter
they're supposed to act on. The underscore really means "comma, or
nothing if pTHX is empty with this set of build options". For details,
see L<perlguts/"How multiple interpreters and concurrency are
supported">. In particular, you have the PERL_SET_CONTEXT() macro


Colin Watson                                  []

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