On 12/12/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > On Dec 12, 2007 2:42 PM, Greg Ewing <[EMAIL PROTECTED]> 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 sleep again. Regardless this thread already resolved the issue with an acceptable solution (yay!) so further discussion is merely a bike shed. -gps
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com