summaryrefslogtreecommitdiff
path: root/src/mscorlib/shared/System
diff options
context:
space:
mode:
authorJustin Van Patten <jvp@justinvp.com>2017-05-04 15:05:38 -0700
committerJustin Van Patten <jvp@justinvp.com>2017-05-04 15:05:38 -0700
commite42e2ce0d6422fc74175e032842aaa5bb38e2112 (patch)
tree8cec36c60ab4bbe50f36d12a19c4afde498b540f /src/mscorlib/shared/System
parent3c17dbc325de61c7899af9d9f019e6d0f561fd19 (diff)
downloadcoreclr-e42e2ce0d6422fc74175e032842aaa5bb38e2112.tar.gz
coreclr-e42e2ce0d6422fc74175e032842aaa5bb38e2112.tar.bz2
coreclr-e42e2ce0d6422fc74175e032842aaa5bb38e2112.zip
Use ReferenceEquals instead of Delegate.op_Equality for sentinel checks
The reference equality check is more efficient than Delegate.op_Equality.
Diffstat (limited to 'src/mscorlib/shared/System')
-rw-r--r--src/mscorlib/shared/System/IO/FileStream.Windows.cs8
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);
}
}