我在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
}
}
但我看到這一點:
也就是說,線程優先級沒有改變(OS:Ubuntu的12.10)。我怎樣才能改變線程的優先級?
給線程一些工作。它開始和結束的速度非常快,而且不能改變成品線的孔隙度。也嘗試 –
他還沒有啓動線程。 –