[Pyobjc-dev] Threads and Queue
Brought to you by:
ronaldoussoren
From: Justin M. <ju...@th...> - 2004-07-30 04:17:35
|
Hey All, I am a little new to both Python and PyObjC. So please be gentle if I am missing something obvious :) I have a project, most of which is written in Objective-C. In an effort to cut down on the amount of code I have to write and to take advantage of Python's large library, I have implemented one of my model's objects in Python. This was easily done, by following examples, including the glue code etc.. But now I have run into some troubles with threading. In an effort to understand threading in python, I have cut and pasted the 'WorkerThread' class (found in Examples/WebServicesTool), this class has functionality similar to my needs (later when I understand what is happening I will make a thread pool class). However, the thread function is only rarely scheduled to execute. It seems to be a problem with Queue. The actual thread function runs OK, and waits on the queue. But when an item is placed on the Queue, via scheduleWork(), only rarely does queue.get() return in the thread, allowing it to run. Is there something I should be doing before I use threads in PyObjC? Some obj-c runtime function I should be calling? Some python function? Thanks in advance, Justin |