I was going through the mutex concepts and code given in below link.
https://learn.microsoft.com/en-us/dotnet/api/system.threading.mutex?view=netcore-3.1
Can anyone let me know if there any way of forcing the threads to execute in FIFO way i.e. the thread which has requested the lock should acquire the lock first.
Are there any code examples like implementing queue for forcing FIFO for multiple thread requesting lock?
For Eg: Thread A, Thread B, Thread C are threads running.
Thread A has requested for Mutex Lock, and has acquired Lock.
Now Thread B came first and waiting to acquire Lock.
After some time Thread C also came and started waiting to acquire Lock.
But surprisingly CLR will cater Thread C instead of Thread B.
Is there any way, as per above example if i see FIFO way, the order should be Thread A, Thread B & Thread C but due to some reasons Thread A, Thread C, & Thread C are executed.