mozilla/rust — pull request #1869 by cpeterso (2012-02-20 07:21:08+00:00)
Title: rt: lock_and_signal fixes

1. Fix a Windows CRITICAL_SECTION leak in lock_and_signal.

2. Initialize Windows CRITICAL_SECTION with non-zero spin count, otherwise it will default to 0, even on multi-processor systems. MSDN suggests using 4000. On single-processor systems, the spin count parameter is ignored and the critical section's spin count defaults to 0.

For Windows >= Vista, extra debug info is allocated for CRITICAL_SECTIONs but not released in a timely manner. Consider using InitializeCriticalSectionEx(CRITICAL_SECTION_NO_DEBUG_INFO).

3. Assert that locks are not reentered on the same thread, unlocked by a different thread, or deleted while locked.