信号量优先

扫码查看
本文介绍了信号量优先的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道System.Threading命名空间中的Semaphore类,但是我不知道它是否允许等待线程具有不同的优先级.

I know about the Semaphore class in the System.Threading namespace, but I don't see if it allows waiting threads to have different priorities levels.

如果两个线程正在等待一个开放的插槽,是否可以让优先级较高的线程拥有第一个开放的插槽?

If two threads are waiting for an open slot, is there a way to allow the thread with the higher priority to have the first open slot available?

推荐答案

来自有关Semaphore类的MSDN文档

但是看看这两个都支持线程优先级的项目.

But take a look at these two projects which both supports priority for threads.

智能线程池

C#中的线程安全优先级队列

这篇关于信号量优先的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 12:08
查看更多