diff options
author | Stephen Toub <stoub@microsoft.com> | 2017-05-05 12:35:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-05 12:35:21 -0400 |
commit | c84237673b6167ee964ba6bea00041dac9dca3e2 (patch) | |
tree | 6f4716f7cab28ba17c8edb0a729815ff74e134ff /src/mscorlib/shared/System | |
parent | 5011a33a24866e14dc7b953bec798ff03901bc2b (diff) | |
parent | e42e2ce0d6422fc74175e032842aaa5bb38e2112 (diff) | |
download | coreclr-c84237673b6167ee964ba6bea00041dac9dca3e2.tar.gz coreclr-c84237673b6167ee964ba6bea00041dac9dca3e2.tar.bz2 coreclr-c84237673b6167ee964ba6bea00041dac9dca3e2.zip |
Merge pull request #11411 from justinvp/delegate_opequality
Use ReferenceEquals instead of Delegate.op_Equality for sentinel checks
Diffstat (limited to 'src/mscorlib/shared/System')
-rw-r--r-- | src/mscorlib/shared/System/IO/FileStream.Windows.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mscorlib/shared/System/IO/FileStream.Windows.cs b/src/mscorlib/shared/System/IO/FileStream.Windows.cs index 7c09ae1a1c..c036ee6a83 100644 --- a/src/mscorlib/shared/System/IO/FileStream.Windows.cs +++ b/src/mscorlib/shared/System/IO/FileStream.Windows.cs @@ -1599,7 +1599,7 @@ namespace System.IO { var awaitable = (AsyncCopyToAwaitable)ThreadPoolBoundHandle.GetNativeOverlappedState(pOVERLAP); - Debug.Assert(awaitable._continuation != s_sentinel, "Sentinel must not have already been set as the continuation"); + Debug.Assert(!ReferenceEquals(awaitable._continuation, s_sentinel), "Sentinel must not have already been set as the continuation"); awaitable._errorCode = errorCode; awaitable._numBytes = numBytes; @@ -1617,15 +1617,15 @@ namespace System.IO } public AsyncCopyToAwaitable GetAwaiter() => this; - public bool IsCompleted => _continuation == s_sentinel; + public bool IsCompleted => ReferenceEquals(_continuation, s_sentinel); public void GetResult() { } public void OnCompleted(Action continuation) => UnsafeOnCompleted(continuation); public void UnsafeOnCompleted(Action continuation) { - if (_continuation == s_sentinel || + if (ReferenceEquals(_continuation, s_sentinel) || Interlocked.CompareExchange(ref _continuation, continuation, null) != null) { - Debug.Assert(_continuation == s_sentinel, $"Expected continuation set to s_sentinel, got ${_continuation}"); + Debug.Assert(ReferenceEquals(_continuation, s_sentinel), $"Expected continuation set to s_sentinel, got ${_continuation}"); Task.Run(continuation); } } |