XS::Framework::Manual::SVAPI::threads - XS::Framework THREADED Perl support
XS::Framework strictly sets PERL_NO_GET_CONTEXT option so that you need to have my_perl (aTHX) in scope. This way threaded perl works faster.
XS::Framework
PERL_NO_GET_CONTEXT
my_perl
aTHX
XS::Framework concept is all about sharing C code, modules that use XS::Framework cannot have different PERL_NO_GET_CONTEXT state. Because in either case, binary incompability between function signatures would occur.
To help dealing with threaded perls XS::Framework defines my_perl alias at global scope, so you could get rid of annoing pTHX and aTHX in every C function.
pTHX
This alias resolves to appropriate perl interpreter pointer in such a way that it costs almost nothing until you create second thread. This is in contrast to perl's default dTHX or PERL_GET_THX which are relatively expensive at C-speeds. After second thread is created, the alias reverts to PERL_GET_THX speeds.
dTHX
PERL_GET_THX
Keep in mind that threaded perl will definitely be slower than standart perl even if you don't create threads because of penalties in perl source code itself. Penalties are usually 20-50% so i would not recommend using threaded perl unless you *really* need perl threads.
Keep in mind that if you call functions with pTHX in theirs signature or call perl functions (not macros, for example Perl_* functions) you still need to pass aTHX manually. However the speedups covered above still apply to aTHX.
XS::Framework::Manual::SVAPI
To install XS::Framework, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XS::Framework
CPAN shell
perl -MCPAN -e shell install XS::Framework
For more information on module installation, please visit the detailed CPAN module installation guide.