Re: pthreads in C++ with embedded Python

2011-06-08 Thread Jason Tackaberry
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

Re: pthreads in C++ with embedded Python

2011-06-08 Thread Tom Brown
On Wed, Jun 8, 2011 at 2:11 PM, Jason Tackaberry t...@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

Re: pthreads in C++ with embedded Python

2011-06-08 Thread Jason Tackaberry
On 11-06-08 06:28 PM, Tom Brown wrote: 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 just tried your example code and indeed it segfaults as is, but works fine for me

pthreads in C++ with embedded Python

2011-06-07 Thread Tom Brown
Hi guys! I am trying to build a C++ application that uses pthreads and embedded python. I've simplified the problem down so that the Python code is a single class that subclasses from Queue. The main thread of the C++ application adds to the queue. A worker thread in the C++ application reads