我在 MonoDevelop 中编写代码,我想尝试 System.Threading 的命名空间。我写了这个简单的代码:
class MainClass {
public static void Main (string[] args) {
System.Threading.Thread thread=new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
Console.WriteLine(thread.Priority);//output current thread priority
thread.Priority=System.Threading.ThreadPriority.Highest;//change thread priority
Console.WriteLine(thread.Priority);//output current thread priority again
}
public static void ThreadProc() {
//make some operations
}
}
但我看到了这个:
即线程优先级没有改变(操作系统:Ubuntu 12.10)。如何更改线程优先级?