RE: perl_alloc or perl_clone?

[email protected] ("JD Brennan")
Newsgroups perl.ithreads
Message-ID <[email protected]>
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?

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?

>      dTHX;
>      PerlInterpreter *one_perl = perl_alloc();
 ...
>      aTHX = one_perl;
>      PERL_SET_CONTEXT(aTHX);

Thanks a bunch!
JD
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.