Process priority change not showing up in Windows Task Manager

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a program that is cpu intensive so I want to change it's priority to
BelowNormal. The code functions without error, the VS Debugger shows the
change but when I then go to "Windows Task Manager" and look at my process it
still has a "Base Pri" of "Normal".

What thing am I missing?


C# Code snippet:

sWrk1 = Thread.CurrentThread.Priority.ToString();
Thread.CurrentThread.Priority = System.Threading.ThreadPriority.BelowNormal;
sWrk2 = Thread.CurrentThread.Priority.ToString();

At this point VS Debugger reports sWrk1 is "Normal" and sWrk2 is
"BelowNormal".

Thanks!
 
Norm said:
I have a program that is cpu intensive so I want to change it's priority to
BelowNormal. The code functions without error, the VS Debugger shows the
change but when I then go to "Windows Task Manager" and look at my process
it
still has a "Base Pri" of "Normal".

What thing am I missing?


C# Code snippet:

sWrk1 = Thread.CurrentThread.Priority.ToString();
Thread.CurrentThread.Priority =
System.Threading.ThreadPriority.BelowNormal;
sWrk2 = Thread.CurrentThread.Priority.ToString();

At this point VS Debugger reports sWrk1 is "Normal" and sWrk2 is
"BelowNormal".

Thanks!

You are not changing the processes priority, you are changing the threads
priority.

you need to set the PriorityClass property on the Process object of your
process, like so

Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal
 
Back
Top