Couple of newbie questions...

Stephen Horne steve at lurking.demon.co.uk
Fri Jul 27 04:55:58 EDT 2001


On 26 Jul 2001 18:05:50 -0700, foobarickknob at yahoo.com (Scott Taylor)
wrote:

>I'm just getting started w/ Python - and have run into a couple issues
>w/ the Windows extensions...
>
>1) time.sleep doesn't seem to release time back to the Win32
>subsystem.  I had a tight loop, and CPU was maxed out at 100% even if
>I did a PumpWaitingMessages w/ a time.sleep.  To actually get the loop
>to return slices of time back to windows and not max out the CPU I had
>to do a PumpWaitingMessages followed by a win32api.Sleep(0) call.  My
>question is - shouldn't time.sleep actually make the process sleep w/o
>hogging CPU?

I've not used this, but it isn't necessarily a problem. It sounds as
if you have 100% usage because of something that is accepting idle
messages - annoying as the CPU indicator doesn't really give a useful
result, but non-idle tasks should still be done before whatever is
grabbing the idle messages.

Disclaimer - this is a general impression, and quite possibly wrong.




More information about the Python-list mailing list