我在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)。如何更改线程优先级?