Windows XP - cron or scheduler for Python?

Tim Golden tim.golden at tesco.net
Fri Jun 25 17:00:36 EDT 2004


Irmen de Jong wrote:
> Tim Golden wrote:
> 
> [...]
> 
>> s.start ()
>> while 1:
>>   try:
>>     try:
>>       pass
>>     except KeyboardInterrupt:
>>       break
>>   finally:
>>     s.stop ()
> 
> 
> That's not a very good way of doing that.
> This will eat 100% CPU time, it's a busy wait loop...
> You should use time.sleep or something else to avoid
> busy waiting.
> But since you used the 'regular' Scheduler class from
> Kronos, it will loop inside the s.start() by itself ... ;-)
> 
> --Irmen

Thanks. For some reason it doesn't actually use
100% CPU, otherwise I'd have spotted it slowing down
my machine. I take the point, though. To be honest,
I was just trying the thing out. Also, I have to
kick myself for even writing that particular piece
of code like that.

TJG



More information about the Python-list mailing list