Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'suppose': 0.05; 'subject:Python': 0.06; 'python': 0.08; 'pm,': 0.10; 'api': 0.11; 'wrote:': 0.14; 'deadlock': 0.16; 'gil.': 0.16; 'mutex': 0.16; 'subject:embedded': 0.16; 'cheers,': 0.19; 'header:In-Reply-To:1': 0.21; 'fine': 0.22; 'replacing': 0.23; 'code': 0.24; 'tried': 0.27; 'example': 0.27; 'problem': 0.28; 'solving': 0.29; 'rid': 0.29; 'module': 0.30; 'performs': 0.30; 'threads': 0.30; 'calling': 0.31; 'to:addr:python-list': 0.33; 'actually': 0.33; 'comment': 0.33; "i'll": 0.34; 'example,': 0.35; 'header:User- Agent:1': 0.35; 'test': 0.35; 'received:ca': 0.36; 'instead.': 0.37; 'could': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'perhaps': 0.39; 'attempt': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; 'your': 0.60; 'kept': 0.67; 'herring,': 0.84; 'dealt': 0.91; 'brown': 0.97 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on orion.urandom.ca X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Date: Wed, 08 Jun 2011 19:25:18 -0400 From: Jason Tackaberry User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110605 Thunderbird/5.0b2pre MIME-Version: 1.0 To: python-list@python.org Subject: Re: pthreads in C++ with embedded Python References: <4DEFE594.2030406@urandom.ca> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307575632 news.xs4all.nl 49179 [::ffff:82.94.164.166]:52421 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7265 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 when I comment out PyEval_ReleaseLock(). Perhaps this was just a red herring, not actually solving your deadlock problem properly? (That is, replacing one problem with another.) > 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. I suppose this could theoretically work in your specific example, but if the Python module you're calling out to spawns threads you're screwed. :) Cheers, Jason.