- Complete implementation including recursion support
- Added an intensive ctest (TestSynchCritical)
- Struct members are used exactly as Windows does it internally:
LockCount starts at -1, RecursionCount at 0
- Same performance optimizations as internally on Windows:
- Fast lock acquisition path using CAS -> SpinCount -> wait
- SpinCount automatically disabled on uniprocessor systems
- On Linux SpinCount is disabled because it provided no advantage over NPTL/futex in all tests
Support for CRITICAL_SECTION's DebugInfo is not yet included (but trivial to add).
- Improved/completed(almost) winpr's critical section implementation
- Replaced WaitForSingleObject locking with critical sections
Note:
WaitForSingleObject should _never_ be used for granular low-contention
locks as it _always_ enters the kernel.
Just replacing WaitForSingleObject locking in Bufferpool with
EnterCriticalSection boosts the multithreaded rfx decoder
performance by almost 400% on win32.