Putting function references in a Queue
Richard Townsend
richard at nospam.com
Wed Aug 10 14:47:37 EDT 2005
On Tue, 09 Aug 2005 23:46:22 GMT, Bryan Olson wrote:
> I think that's a good thing to do. The tricky part is getting an
> event loop to wait on both the queue and other kinds of events.
> Periodic polling works, but kind of sucks.
>
> What's the 'done' argument? A lock maybe?
'done' is just a boolean for the child thread to indicate it has finished.
The main thread keeps a dictionary of references to the child threads so
the app can send then 'abort' messages via their input Queues. When a child
thread sets 'done' to True, the main thread deletes its reference from the
dictionary.
Periodic polling triggered by a timer in the X-app main loop was the only
way I could think of checking for feedback from the child threads, not very
neat though...
Thanks to everyone for their input!
--
Richard
More information about the Python-list
mailing list