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 this:
The
FifoSemaphoreworks exactly like a normalSemaphorebut also guarantees that tokens are served out to acquirers in the order that they manage to acquire the internal lock. The usage of aFifoSemaphoreis identical to aSemaphore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With