diff options
Diffstat (limited to 'src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs')
-rw-r--r-- | src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs b/src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs index bf9f9cbb2c..0c80afd22c 100644 --- a/src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs +++ b/src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs @@ -131,7 +131,7 @@ namespace System.Threading.Tasks { // Spin wait until the completion is finalized by another thread. var sw = new SpinWait(); - while (!m_task.IsCompleted) + while (!m_task.IsCompleted) sw.SpinOnce(); } @@ -185,7 +185,7 @@ namespace System.Threading.Tasks public bool TrySetException(IEnumerable<Exception> exceptions) { if (exceptions == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.exceptions); - + List<Exception> defensiveCopy = new List<Exception>(); foreach (Exception e in exceptions) { @@ -276,7 +276,7 @@ namespace System.Threading.Tasks public bool TrySetResult(TResult result) { bool rval = m_task.TrySetResult(result); - if (!rval && !m_task.IsCompleted) SpinUntilCompleted(); + if (!rval) SpinUntilCompleted(); return rval; } @@ -346,7 +346,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The <see cref="Task"/> was disposed.</exception> public void SetCanceled() { - if(!TrySetCanceled()) + if (!TrySetCanceled()) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.TaskT_TransitionToFinal_AlreadyCompleted); } } |