multi-thread python interpreaters and c++ program

myopc myopc at aaa.com
Tue Jun 9 21:39:58 EDT 2009


thanks for your reply!

"Lie Ryan" <lie.1296 at gmail.com> $y61.12599 at news-server.bigpond.net.au...
> myopc wrote:
>> hi, all
>>  I am ruuning a c++ program (boost python) , which create many python
>> interpreaters and each run a python script with use multi-thread
>> (threading).
>> when the c++ main program exit, I want to shut down python
>> interpreaters, but it crashed. I have googled a lot but cant get any 
>> clue.
>> here is my code, your suggestion will be greatly appreciated.
>>
>
> There is no clean way to terminate a thread cleanly from outside. You
> need to let the thread terminates by itself. If it is a pure python
> code, this can be done by one of:
> 1) setting a global/thread stop value that is checked by each threads
> 2) inserting a QUIT event to the event-loop
>
>
> I have never used boost before, so I don't know what it can and cannot
> do from outside the python's interpreter. However, this should give you
> an idea of what to do... 




More information about the Python-list mailing list