pthreads in C++ with embedded Python

Tom Brown tom at zanttz.com
Wed Jun 8 18:28:29 EDT 2011


On Wed, Jun 8, 2011 at 2:11 PM, Jason Tackaberry <tack at urandom.ca> wrote:

> On 11-06-07 07:29 PM, Tom Brown wrote:
>
>> Any suggestions will be appreciated.
>>
>
> Why are you calling PyEval_ReleaseLock() in the CmdThread constructor?
>  This looks suspicious.
>
> Also, I don't see where CmdThread::lock() and CmdThread::unlock() are being
> invoked in your example.  Relics from your effort to create a reduced
> testcase I assume?
>
>
Jason,

I found that PyEval_ReleaseLock() was necessary to keep the program from
hanging. The lock() and unlock() methods were used in a previous attempt to
lock/unlock the GIL.

I kept banging at this and finally gave up on the GIL. I used a mutex
instead. This allowed me to get rid of the Python API calls that dealt with
the GIL. It works great in the test program. I'll find out how well it
performs in the real program.

Thanks!
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110608/f0d8e6e7/attachment.html>


More information about the Python-list mailing list