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

Re: thread safe

Thread Previous | Thread Next
From:
Colin Watson
Date:
February 2, 2003 13:03
Subject:
Re: thread safe
Message ID:
20030202210320.GA15387@riva.ucam.org
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:

  SV*
  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
available.

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]

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