[Python-Dev] Signals+Threads (PyGTK waking up 10x/sec).
Gregory P. Smith
greg at krypto.org
Thu Dec 13 09:44:59 CET 2007
On 12/12/07, Guido van Rossum <guido at python.org> wrote:
> On Dec 12, 2007 2:42 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> > But there's no excuse for using CPU when the application
> > truly isn't doing anything other than waiting for
> > something to happen.
> There are tons of situations where polling is quite reasonable as logn
> as it involves a sleep.
Now that I have to disagree with, possibly because sleep is ambiguous as
stated. Periodic time based polling means your APIs are broken (not that
one often has control over what APIs are available). Blocking only to be
woken up when any of the events your interested in is always best. If you
have periodic tasks that must be performed then obviously an event you're
interested in is "time T or X time has passed" but that is distinct from a
process waking up regularly to check the empty work queue length only to
Regardless this thread already resolved the issue with an acceptable
solution (yay!) so further discussion is merely a bike shed.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev