mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
The problem was triggered in a situation where threads were competing for the write-lock and were using timeout: - thread t1 takes the lock (state = RwWrite) - thread t2 tries to take the lock but fails because of t1, it registers it interest (state = RwWrite | RwWait) and goes to sleep - thread t3 tries to take the lock but failes because of t1 and don't register any interest because t2 did it already (state = RwWrite | RwWait) - t1 releases the lock, waking up t2 and t3 which race for it with t3 winning the race (state = RwWrite) - t2 tries to go back to sleep but has overrun its timeout so it exits. - with t2 exiting, it tries to remove previously registered interest (state = RwWrite - RwWait -> corruption).