hbirr@svn.reactos.com wrote:
Fixed a bug in RtlLeaveCriticalSection. We have only to signal the event if someone waits on it.
I believe this change is incorrect. This change introduces the exact same bug I fixed in r14326.
The reason why this change is incorrect is, that you can't rely on LockCount. It may be incremented anytime a thread enters a critical section and waits for it. That's why there's the RecursionCount field, it is the only information we can rely on to determine whether we're about to release the lock or not. In this code path we already know that we left the last recursion, so no matter what the LockCount is at the moment (depends on how many threads are waiting for the critical section), we always need to unwait one waiter!
This change most likely will introduce a dead-lock of cygwin.
Best Regards,
Thomas