[C++-sig] Boost.Python and threads

Niall Douglas s_sourceforge at nedprod.com
Tue Sep 19 17:15:09 CEST 2006


On 19 Sep 2006 at 16:08, thor.arne.johansen at ibas.no wrote:

> What is the status for threads and Boost.Python.

BPL needs patching.

> I wish to have multiple (Python) threads.
> Each thread owns an instance of a wrapped C++ object doing extensive disk
> IO.
> 
> Will Boost.Python release the GIL when executing the C++ code?
> If I make a C++ wrapper which releases the GIL before executing the code,
> will that be safe? (Can I be sure the internals of Boost.Python does not
> call into Python Interpreter, without holding the GIL?)
> 
> Note I'm extending, and not embedding, so I will only have one Python
> interpreter with multiple threads, each running C++ code wrapped with
> Boost.Python.

Search the list archives. You'll find a patch integrating the 
necessary code, though you'll have to update it to match your 
threading system. Use TnFOX from SVN (http://www.nedprod.com/TnFOX/) 
as an example.

Cheers,
Niall






More information about the Cplusplus-sig mailing list