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

Threaded-perl & C++XS future.

Thread Next
From:
Олег Пронин
Date:
February 5, 2015 20:15
Subject:
Threaded-perl & C++XS future.
Message ID:
CABFBc461JUDEcapb-+VkwBArF=pXJWAEdCTE4_Te_csRoBTeBA@mail.gmail.com
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About