[Pythonmac-SIG] problem with CarbonEvt, Thread and sleep

Ronald Oussoren ronaldoussoren at mac.com
Mon Jul 2 11:12:03 CEST 2007


 
On Monday, July 02, 2007, at 10:54AM, "has" <hengist.podd at virgin.net> wrote:
>Hi all,
>
>Trying to implement a watchdog thread in a Carbon Event-based  
>application. Trouble is, the thread's sleep() call never seems to  
>return. (10.4.9/PPC/Python 2.5) Demonstration code below:
>
[... snip code ...] 
>
>
>Any ideas?

There is no threading support in the Carbon bindings. The wrapper for RunApplicationEventLoop doesn't give up the GIL, which means other Python threads don't get a chance to run unless the main thread is actually handling events in Python code.

You might be able to get this to work with the autoGIL module, but I don't fully trust that approach.

Ronald



More information about the Pythonmac-SIG mailing list