DIGG IT!
2
Comments
Published
Tuesday, June 21, 2005
at
8:41 AM
.
I was working on a server for a client in Python using SYNC and we were seeing CPU utilization of 100% on WIN32 ( 2000, XP, 2003 ). I was a puzzled as I know Python was just listening to the OS select loop for socket events. Ted on Twitter - @__ted__
Ted on Adobe Groups
Ted on LinkedIn
Ted on Facebook
Ted at Adobe
Are you using the time.sleep() function, or some stackless/tasklet function?
BTW - that's pretty damn fast ;)
time.sleep(.01) works great although the argument is seconds not msecond and accuracy is a question. The actual sleep time can vary both shorter or longer than the passed second value.
In this case the smaller delay the better using sleep(.0001) makes sence.
From the docs:
time.sleep(secs)
Suspend execution for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. 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.
Cheers,
ted ;)