Skip to content
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

Replacing usage of ManualResetEvent with ManualResetEventSlim #837

Merged
merged 1 commit into from
May 14, 2020

Conversation

stebet
Copy link
Contributor

@stebet stebet commented May 14, 2020

Proposed Changes

Since the client never does cross-appdomain or cross-process communication internally, there is no need to use ManualResetEvent instead of ManualResetEventSlim.

ManualResetEventSlim can often avoid allocating a kernel-level object by using a spinlock wait mechanism for a short duration before switching so it can often stay inside the managed code boundaries.

See detailed description and performance characteristics here: https://download.microsoft.com/download/B/C/F/BCFD4868-1354-45E3-B71B-B851CD78733D/PerformanceCharacteristicsOfSyncPrimitives.pdf

Types of Changes

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

…sed as a more lightweight synchronization primitive.
@lukebakken lukebakken added this to the 6.1.0 milestone May 14, 2020
@lukebakken lukebakken self-assigned this May 14, 2020
@michaelklishin
Copy link
Member

I see no downsides to switching. Thank you for your time @stebet 👍

@michaelklishin michaelklishin merged commit d4b2f67 into rabbitmq:master May 14, 2020
michaelklishin added a commit that referenced this pull request May 14, 2020
Replacing usage of ManualResetEvent with ManualResetEventSlim

(cherry picked from commit d4b2f67)
@michaelklishin
Copy link
Member

Backported to 6.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants