Skip to content
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
stephentoub:sockets_mres_spinning
Jan 26, 2016
Merged

Remove spinning from event instances in Unix socket operations#5655
stephentoub merged 1 commit intodotnet:masterfrom
stephentoub:sockets_mres_spinning

Conversation

@stephentoub
Copy link
Member

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.)

@stephentoub
Copy link
Member Author

@ericeil, @pgavlin, mind taking a look? Pat, this is the same as the change you previously shared locally.

@pgavlin
Copy link
Contributor

pgavlin commented Jan 26, 2016

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
@stephentoub stephentoub merged commit fe0621e into dotnet:master Jan 26, 2016
@stephentoub stephentoub deleted the sockets_mres_spinning branch January 26, 2016 16:21
@karelz karelz modified the milestone: 1.0.0-rtm Dec 3, 2016
@karelz karelz added the os-linux Linux OS (any supported distro) label Mar 8, 2017
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Net os-linux Linux OS (any supported distro)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants