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

Niall Douglas s_sourceforge at nedprod.com
Sat Oct 4 01:22:03 CEST 2003


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

On 3 Oct 2003 at 18:28, David Abrahams wrote:

> > I've followed the thread about boost.python multithreading between
> > Lijun Qin and David Abrahams and I wondered where was the
> > implementation of this ? If there is no implementation, what is the
> > best way to safely unblock the python threads ? Or at least where
> > can I find information about this ?
> 
> Sorry it took so long to reply Pierre; I was really hoping someone
> else (like Lijun) would answer.
> 
> Anyway, I don't have an implementation of multithreading support, at
> least not yet.
> 
> THe best way to safely unblock threads that I know of is to write a
> thin wrapper around your function which uses Py_BEGIN_ALLOW_THREADS
> and Py_END_ALLOW_THREADS around a call to the real function.

What did you think of my idea for a macro (say 
"BOOST_PYTHON_ALWAYS_UNLOCK_GIL") which compiles it unlocking and 
relocking around every traversal from BP into C++ code?

Inefficient, but changing a mutex is nothing when compared to 
executing a single python byteop.

Cheers,
Niall





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

iQA/AwUBP34EnMEcvDLFGKbPEQLQzwCfbBKC3LtfNiZIv9zMGqzS5kSIPUsAoPSX
OMTz2Lnlv4OKRqye5cLRDeoZ
=P2Rk
-----END PGP SIGNATURE-----




More information about the Cplusplus-sig mailing list