gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 11:14:44 27 4
gpt4 key购买 nike

我在 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
}
}

但是我看到了这个: enter image description here

即线程优先级没有改变(OS:Ubuntu 12.10)。如何更改线程优先级?

最佳答案

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

参见 source code在 github 上。

关于c# - Mono:是否支持更改线程的优先级?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12994862/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com