Home  |  Linux  | Mysql  | PHP  | XML
From:Josef Wolf Date:Mon Aug  4 00:04:15 2008
Subject:Re: XS callbacks from different threads.
On Sun, Aug 03, 2008 at 10:07:26PM +0300, Shmuel Fomberg wrote:
> Josef Wolf wrote:
> 
> > IIUC, I don't need to create multiple PerlInterpreter's.  I just need
> > to set up the TLS properly in each thread.  But it is not clear to me
> > how to do that.
> >    # Main thread returns immediately after creating background threads
> >    # For now we only sit and wait until we get killed.  In a future
> >    # improvement we might periodically check for configuration
> >    # changes and restart.
> 
> 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.

Thanks for your answer, Shmuel!

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?

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?

Navigate in group perl.ithreads at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants