2

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

4

2 回答 2

1

更改线程优先级尚未实现。

参见github 上的源代码。

于 2012-10-21T17:03:26.617 回答
1

这最近在 Mono 4.4 中实现。相关文档在这里

于 2016-05-02T07:48:47.207 回答