[Python-Dev] Making Queue.Queue easier to use

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Thu Oct 13 15:07:06 CEST 2005

  I'd just like to point out that Queue is not quite as useful as people
seem to think in this thread.  The main problem is that I can't
integrate Queue into a select/poll based main loop.

  The other day I wanted extended a python main loop, which uses poll(),
to be thread safe, so I could queue idle functions from separate
threads.  Obviously Queue doesn't work (no file descriptor to poll), so
I just ended up creating a pipe, to which I send a single byte when I
want to "wake up" the main loop to make it realize changes in its
configuration, such as a new callback added.

  I guess this is partly an unix problem.  There's no system call to say
like "wake me up when one of these descriptors has data OR when this
condition variable is set".  Windows has WaitForMultipleObjects, which I
suspect is quite a bit more powerful.


Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.

More information about the Python-Dev mailing list