开发者

Guaranteed semaphore order?

开发者 https://www.devze.com 2022-12-25 11:06 出处:网络
Th开发者_如何学编程e documentation for the .NET Semaphore class states that: There is no guaranteed order, such as FIFO or LIFO, in which blocked threads enter the semaphore.

Th开发者_如何学编程e documentation for the .NET Semaphore class states that:

There is no guaranteed order, such as FIFO or LIFO, in which blocked threads enter the semaphore.

In this case, if I want a guaranteed order (either FIFO or LIFO), what are my options? Is this something that just isn't easily possible? Would I have to write my own Semaphore? I assume that would be pretty advanced?

Thanks,

Steve


See this:

The FifoSemaphore works exactly like a normal Semaphore but also guarantees that tokens are served out to acquirers in the order that they manage to acquire the internal lock. The usage of a FifoSemaphore is identical to a Semaphore.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号