develooper Front page | perl.ithreads | Postings from August 2008

Re: XS callbacks from different threads.

Thread Previous | Thread Next
Shmuel Fomberg
August 4, 2008 10:12
Re: XS callbacks from different threads.
Message ID:
Hi Josef.

>> IANAE, (I am not an expert) but if you say that the main thread returns 
>> immediately and waiting in a loop for the lib, then you already have one 
>> thread inside Perl. So the background threads shouldn't call into your 
>> perl interpreter.
> If I understand correctly, I have two options then:
> 1. _not_ let the main thread return back from the XS.  That is, I
>    move the sleep(0) from the perl script into the init() function.
>    Would that break anything withhin perl?

For this one you need a real expert. It is possible to call into Perl 
from an XS sub. but to call into Perl from other threads while it is 
inside a XS call? I have no idea.

> 2. I need to create a second perl interpreter (or clone the first one).
>    Can somebody point me to example code how to do that?

That's actually no big deal. look at perldoc page perlembed, there are 


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