It is unlikely that you can change the thin lock to be fair, especially since the documentation does not indicate any method of doing this, and most locks today are unfair for performance reasons.
However, it’s quite simple to collapse your own FIFO lock with Windows events and a 64-bit control word that you manipulate with compare and exchange , which is still very subtle. Here's the diagram:
, ( ) ( "" ). reset , ( slim).
:
- , . (2) (3).
N . N . , 1 - 30 , . (, ). , , (1), ( (2) → (1)).
(2) + + 0 . 1 , , , . manual < reset, , , FIFO. , , . , , . . ( 0), , .
. , . , , . , - (3) , . , , , , .
. , lock() unlock() , , , ( ), . , (, , ). , " ..." . , , , CAS.
"" - . , , . , () , 0 (), , 0 , , () , / : . , " " , , rwlock, , / . , , . rwlock: , ( /), !
, , Windows Event, - , , , . CRITICAL_SECTION.
, , FIFO. , , , , , . .
FIFO FIFO . FIFO , FIFO , FIFO: , , , "", , . : , , , , FIFO, .
- , . , . , , , , , - (, ).
, , , - . , , .
gotchas ( , , , ), . , rwlock, rwlock, . , , , , , .
- , Windows, , , , . , , , slim lock , . , -: , . , . ( ).