pyt...@bdurham.com wrote: > We have a bunch of command line utilities that use all the CPU > capacity available to them. Our customer has asked us to find ways we > might make these utilities more system friendly by occassionally > calling what they refered to as a win32 equivalent of VB's (Visual > Basic) doevents() function. > > I googled this topic and found a Mark Hammond suggestion with > qualifications[1]: > > win32gui.Pump(Waiting)Messages > > Is there a recommended way to run our utilities in a more CPU friendly > way?
Not if they are command-line utilities. That UI only applies to applications that have a message loop, and yours doesn't have one. One alternative would be to reduce your processes priority: http://code.activestate.com/recipes/496767-set-process-priority-in-windows/ Set yourself to BELOW_NORMAL_PRIORITY_CLASS and you'll be friendlier. > I was thinking of calling time.sleep( P ) every N iterations through > our processing but I'm not clear on the pros and cons of this > technique vs. a strategy that proactively pumps waiting messages. Yep, in a console application, that's exactly the right way. Calling time.sleep(0) will release the CPU if there is anyone else waiting. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32