[C++-sig] boost and threads

Niall Douglas s_sourceforge at nedprod.com
Sat Jul 24 02:43:58 CEST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 23 Jul 2004 at 13:11, Peter Bradshaw wrote:

> An app where embedded python scripts control a number of C++ analysis
> functions that are run over a bunch of mp3's. The idea is that each
> thread would do a PyRunSimpleString or similar to run a python
> function that controls and organises the analysis of an mp3. The
> dispatch/organisation of mp3 selection could be handled in a thread
> safe manner in C++.
> 
> Q:
> I'm aware that there's probably some Python/C API stuff I have to
> learn/implement, but I'm curious if boost::python will play nicely in
> this situation. That is, if different objects of the same wrapped
> class being accessed from diffferent threads will I have issues?

So long as you are holding the python GIL when you call boost.python, 
everything should be fine. Of course, all time spent inside python 
and any code of yours python calls will be single threaded due to the 
mutex.

Cheers,
Niall





-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2

iQA/AwUBQQGwzsEcvDLFGKbPEQJLGQCg5BfuPPyNTUh8wyN+Fh/NNFk7+3IAoPNC
GxL4p3GtE+JPsTHFeLymsvnX
=ns8g
-----END PGP SIGNATURE-----



More information about the Cplusplus-sig mailing list