[C++-sig] A few questions on Boost.Python

Niall Douglas s_sourceforge at nedprod.com
Tue Jan 24 09:38:54 CET 2012


On 24 Jan 2012 at 9:32, Anders Wallin wrote:

> >> 5) I also read that Boost.Python is not thread safe, is that true and if
> >> yes can it be fixed/hacked ?

Not thread *aware* would be more accurate.

> > Other people on this list know a lot more than I do about this topic.  I
> > believe the answer depends on whether the multithreaded programming crosses
> > the C++/Python boundary.
> 
> FWIW, it is quite straightforward to write C++ code that uses e.g.
> OpenMP to do work in multiple threads, and then returns results to
> python.
> I've only done a case where we wait in python for the c++
> function(that potentially uses OpenMP or other threading libs) to
> finish before continuing.

Sure that ought to work. Whatever you do though, do NOT call into 
python from within an OpenMP expanded piece of code as you'll run 
into GIL problems - unless you handle the GIL manually.

Niall

-- 
Technology & Consulting Services - ned Productions Limited.
http://www.nedproductions.biz/. VAT reg: IE 9708311Q. Company no: 
472909.





More information about the Cplusplus-sig mailing list