Will python ever have signalhandlers in threads?
exarkun at divmod.com
Mon Nov 15 16:22:41 CET 2004
On 15 Nov 2004 11:44:31 GMT, Antoon Pardon <apardon at forel.vub.ac.be> wrote:
>Op 2004-11-15, Peter Hansen schreef <peter at engcorp.com>:
> > Antoon Pardon wrote:
> >> AFAIU the Queue module doesn't block on a full/empty queue when
> >> a timeout is specified but goes in a loop sleeping and periodically
> >> checking whether place/items are available. With signals that
> >> can be sent to a thread the queue could just set an alarm and
> >> then block as if no timeout value was set and either unblock
> >> when place/items are available or get signalled when the timeout
> >> period is over.
> > I'm fairly sure that the Queue uses an internal Event
> > (or REvent?) to signal when space or a new item is
> > available, so I believe your description (and possibly
> > conclusion) above is wrong. There should be no
> > "periodical check", as that would imply polling. Check
> > the source if you're interested.
> I did check the source, I just didn't study it carefully
> and got my understanding mostly from the comments.
> But anyway here is the relevant part and IMO we have
> a polling loop here.
You are correct, but why does it matter? The Queue class works. Why should Python be changed in a difficult and complex way to... make the Queue class continue to work? If you can give other examples of the uses you have in mind, that might help convince people of the value of this change. But be sure you give examples of things that don't already work.
More information about the Python-list