JD Brennan wrote:
Currently, I'm doing:

 char *args[]  = { "jperl", perlfile };
 int  argcount = 2;

 PerlInterpreter* my_perl = perl_alloc();
 PERL_SET_CONTEXT(my_perl);
 perl_construct(my_perl);

 PERL_SET_CONTEXT(my_perl);
 int status = perl_parse(my_perl, xs_init, argcount, args, NULL);
 ...
 PERL_SET_CONTEXT(my_perl);
 // Fill up Parse and Perl DS conversion code here
 PL_PARSE_ARGS;

 int count = perl_call_pv(fname, G_ARRAY | G_EVAL);
 SPAGAIN;
 ...

Doesn't seem like the subsequent PERL_SET_CONTEXT() calls
are needed since I'm using one PerlInterpreter* per pthread.
Once I've set it into my thread's context, then it shouldn't
change, right?

It's true that you need to have it set only once in the above code. However, you don't show how other pthreads set the perl interpreter.

Doesn't seem like the dTHX and aTHX add anything. From looking at the macro expansion they just create another local variable
of type PerlInterpreter*.  Is that important?

It's important if you want your application to work with and w/o ithreaded perl. So it compiles with either of the two.

    dTHX;
    PerlInterpreter *one_perl = perl_alloc();

 ...

    aTHX = one_perl;
    PERL_SET_CONTEXT(aTHX);


Thanks a bunch!
JD


--
_____________________________________________________________
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The "Practical mod_perl" book       http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/

Reply via email to