[wxPython-users] Can you limit CPU resources for the running app ?

Robin Dunn robin at alldunn.com
Wed Jan 16 16:40:12 PST 2008


Geoff Skerrett wrote:
> I have a wx app that does some image processing. Occasionally a user 
> will select a large number of images (100+) and it can take 30-40mins to 
> complete the process.  All of the users are WindowsXP.
>  
> Is there anyway to "restrict" the amount of cpu/resources that the 
> application uses ?
> The users understand that it takes a specific amount of time, however, 
> they would like to use their workstation for other tasks.  Once 
> launched our app consumes all the cpu resources so the workstation 
> appears "Frozen".
>  
> I have little experience with threading, but was wondering if this would 
> solve the problem.   I noticed in the python docs that the "threading" 
> class says that is does not have support for priorities - which sound 
> like what I am looking for, but unsure.
>  
> Note that this is not a case of the the user complaining that the app's 
> GUI is unresponsive, but rather that the entire SYSTEM is un-responsive.

I know that there is a win32 API for limiting a process to just one CPU, 
so I expect that there are APIs for setting priority (like unix's nice() 
function) but I don't know details.  Searching MSDN will probably turn 
up something, and then you can probably use ctypes to call it.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!




More information about the wxpython-users mailing list