Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

The 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 Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
556 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...