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

Threaded-perl & C++XS future.

Thread Next
Олег Пронин
February 5, 2015 20:15
Threaded-perl & C++XS future.
Message ID:
Currently i'm having a lot of troubles with developing XS frameworks
while keeping support for threaded perls

1) annoying pTHX/aTHX
2) annoying class members 'my_perl' needed for destructors (or dTHX
instead) when PERL_NO_GET_CONTEXT (because C++ desctructors has no
args, you cant pass aTHX, so you either save my_perl as an object
member in constructor, or use less efficient dTHX in desctructor).
The same applies for callbacks which are called from C libs
(libevent/libuv) and works with perl variables.
3) C++ XS frameworks not working after threads->create, because you
either get core dump on double C++ object delete, or (if CLONE_SKIP)
get a ref to undef which is not better anyway.

I didn't find any callback/hook that perl calls on every blessed
object when perl_clone().
Is there any?

If not it seems impossible to properly implement XS objects with C
underlying data.
What is the status of threaded perl? does anybody use it? will it be
okay if XS cpan modules will no longer support it?

Oleg Pronin,
CTO, Co-Founder,
Crazy Panda LTD
CP Decision LTD

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