views:

75

answers:

1

Hi! I have the following problem - I want to set my C++ application's Base priority to 31 if that is possible or at least set its current priority to 31.

So I need a simple example like

  1. set priority to 31;
  2. for (i=0;i<100000;++i) { printf("hello world"); }
  3. set priority to 8 or keep 31 if possible
+2  A: 

In order to set your priority class to the realtime priority class, you need to be running with elevated privileges (as an admin).

As others have asked, are you SURE you want to do this? If you set your priority that high, it will lock out all other processing on the system (even the mouse will stop working).

One option that allows you to perform operations without being preempted that's somewhat more system friendly (but only available on Vista and beyond) is to use the Multimedia Class Scheduler Service (MMCSS).

Larry Osterman
Sory - _"Windows Server 2003 and Windows XP/2000: MMCSS is not available."_ and I am working with XP sp3 using vs2005
Kabumbus