This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Remove spinning from event instances in Unix socket operations#5655
Merged
stephentoub merged 1 commit intodotnet:masterfrom Jan 26, 2016
Merged
Remove spinning from event instances in Unix socket operations#5655stephentoub merged 1 commit intodotnet:masterfrom
stephentoub merged 1 commit intodotnet:masterfrom
Conversation
benaadams
added a commit
to benaadams/KestrelHttpServer
that referenced
this pull request
Jan 24, 2016
Member
Author
Contributor
|
LGTM. Thanks for doing this. |
stephentoub
added a commit
that referenced
this pull request
Jan 26, 2016
Remove spinning from event instances in Unix socket operations
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
…pinning Remove spinning from event instances in Unix socket operations Commit migrated from dotnet/corefx@fe0621e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We use ManualResetEventSlims to enable blocking waiting for non-blocking socket operations to complete when making calls to Socket's synchronous methods. By default, if an MRES isn't yet Set when it's waited on, MRES.Wait() does a bit of spinning before falling back to a true blocking wait. But in this situation, we expect that either the socket operation will complete synchronously or will take some non-trivial amount of time to complete asynchronously, in which case the spinning is generally unnecessary overhead. This commit simply disables that extra spinning.
cc: @pgavlin, @ericeil, @vancem
(Assuming #5472 gets checked in after the issues it's facing are fixed, this change will still matter but only in the situation where sync and async calls are mixed on the same Socket instance, such that the socket is put into non-blocking mode and we hit these code paths.)