[C++-sig] [patch] Make boost python accessible by multiplethreads

Niall Douglas s_sourceforge at nedprod.com
Wed Jul 21 15:02:28 CEST 2010


On 19 Jul 2010 at 9:40, Matthew Scouten (TT) wrote:

> I agree that automatic GIL Management should not go main line unless it
> is done right. 
> 
> I would like some facilities for manual GIL management though.
> 
> I have a RAII object for taking the GIL around a virtual function, and
> another for freeing the GIL around a call in. Something like that would
> be nice to put in the library. I can donate mine if asked...  

Sorry for the delay in replying. Stuff came up.

I would have no objections so long as any such code would be marked 
as deprecated and that it will be removed in the future.

To explain why, proper threading support with hanging locks would be 
incompatible with a naïve RAII GIL management object. Also, if I 
remember correctly there is additional work required to get multiple 
embedded interpreters to correctly work simultaneously, and again a 
simple RAII style GIL management isn't quite enough. In particular, 
if I remember correctly, the context for the current interpreter for 
this thread must be managed separately from the GIL for a particular 
interpreter, especially if the two interpreters are calling into one 
another via intervening C++ code but still accessing data in both 
simultaneously.

HTH,
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