time.sleep(1) sometimes runs for 200 seconds under windows

Benji York benji at benjiyork.com
Thu Feb 23 16:33:08 EST 2006


Paul Probert wrote:
 > Hi, My app runs in a loop looking for changes in a database, and like
 > a good boy I call time.sleep(1) inside the loop. Unfortunately this
 > sometimes runs for 200 seconds or so, presumably while my OS is
 > calling Bill Gates to tell him what I've been doing. This happens
 > under NT4, W2k, and XP. What do people do to fix this? Thanks!

 From the docs for time.sleep:

     The actual suspension time may be less than that requested because
     any caught signal will terminate the sleep() following execution of
     that signal's catching routine. Also, the suspension time may be
     longer than requested by an arbitrary amount because of the
     scheduling of other activity in the system.
--
Benji York



More information about the Python-list mailing list