Thanks!
The following code works and does what I was looking for, but in Windows XP pro that I am using the Windows Task Manager still shows
the Base Priority as Normal. I can tell by looking at CPU percent of utilization that the code is working.
using System.Threadin g; // for Thread
public static void GetPriority() // display priority status
{
string st = Thread.CurrentT hread.Priority. ToString();
Console.WriteLi ne("Priority is " + st);
}
public static void SetPriority(int p) // change priority to p
{
if (p == 2)
Thread.CurrentT hread.Priority = ThreadPriority. Highest;
else if (p == 1)
Thread.CurrentT hread.Priority = ThreadPriority. AboveNormal;
else if (p == -1)
Thread.CurrentT hread.Priority = ThreadPriority. BelowNormal;
else if (p == -2)
Thread.CurrentT hread.Priority = ThreadPriority. Lowest;
else
Thread.CurrentT hread.Priority = ThreadPriority. Normal;
GetPriority();
}
-Harry
"Richard" <Ri*****@discus sions.microsoft .com> wrote in message news:D0******** *************** ***********@mic rosoft.com...
using System.Threadin g;
...
Thread.CurrentT hread.Priority = ThreadPriority. BelowNormal;
...
--Richard
"Harry J. Smith" wrote:
How can a program change its execution priority in the operating system while it is running?
-Harry