Skip to content

rt: lock_and_signal fixes #1869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 20, 2012
Merged

rt: lock_and_signal fixes #1869

merged 3 commits into from
Feb 20, 2012

Conversation

cpeterso
Copy link
Contributor

  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.

If a CRITICAL_SECTION is not initialized with a spin count, 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).
Assert that locks are not reentered on the same thread, unlocked by a
different thread, or deleted while locked.
brson added a commit that referenced this pull request Feb 20, 2012
rt: lock_and_signal fixes
@brson brson merged commit 657ef8e into rust-lang:master Feb 20, 2012
@brson
Copy link
Contributor

brson commented Feb 20, 2012

Thanks!

Kobzol pushed a commit to Kobzol/rust that referenced this pull request Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this pull request Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants