Queue enhancement suggestion

Diez B. Roggisch deets at nospam.web.de
Tue Apr 17 14:05:06 EDT 2007


> The problem is that sometimes the gui thread has something to show
> too. With the added problem that the code wanting to show something
> doesn't know when it is executing the gui thread or an other. So
> it is very difficult to avoid the gui thread putting things on the
> queue. But since the gui thread is the single reader, it will dead
> lock if the queue happens to be full at the moment the gui thread
> want to add another item.

This sounds like a pretty constructed case to me. After all, it's not 
too hard to determine that the thread running is the gui-thread. Combine 
this with a simple thread-local "put-my-event-in-the-queue"-function and 
you can either stuff it in the queue in worker threads, or create a 
toolkit event in case of the gui-thread.


Diez



More information about the Python-list mailing list