Queue enhancement suggestion

Antoon Pardon apardon at forel.vub.ac.be
Wed Apr 18 03:37:11 EDT 2007


On 2007-04-18, Hendrik van Rooyen <mail at microcorp.co.za> wrote:
>  "Antoon Pardon" <a...n at f.l.vub.ac.be> wrote:
>
>
>> 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 can happen - I suppose the cure is to have the GUI use a non blocking
> put in a try except checking for the full condition - its bad to block the GUI
> anyway because then the mouse and kbd become unresponsive.  So even
> the reads (get) have to be non blocking, or the thing will behave like a 
> disobedient dog, that knows what to do, but just refuses.

My queue module has a "register" call. So you can register it to GTK the
same way you can register a pipe or network connection. So the gui will
only try to get things from the queue if there is something in it.

-- 
Antoon Pardon



More information about the Python-list mailing list