Mono:是否支持更改线程的优先级?

问题描述 投票:2回答: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)。如何更改线程优先级?

c# multithreading mono xamarin.android
2个回答
1
投票

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

请参见github上的source code


1
投票

最近已在Mono 4.4中实现。 Relevant docs here

© www.soinside.com 2019 - 2024. All rights reserved.