diff options
author | Stephen Toub <stoub@microsoft.com> | 2017-04-18 13:57:19 -0400 |
---|---|---|
committer | Stephen Toub <stoub@microsoft.com> | 2017-04-18 13:57:19 -0400 |
commit | cbd3f54c7dbd3808e2d8b1e4dc1040f511147d19 (patch) | |
tree | bdf68f28c5fbde366c2a8e04a13c2618817ace46 /src/mscorlib/shared/System | |
parent | bbe202b1de189812866acfa288ab1ac21a5fecdb (diff) | |
download | coreclr-cbd3f54c7dbd3808e2d8b1e4dc1040f511147d19.tar.gz coreclr-cbd3f54c7dbd3808e2d8b1e4dc1040f511147d19.tar.bz2 coreclr-cbd3f54c7dbd3808e2d8b1e4dc1040f511147d19.zip |
Expose Task.IsCompletedSuccessfully
Diffstat (limited to 'src/mscorlib/shared/System')
-rw-r--r-- | src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs b/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs index 1098299517..97f2013d79 100644 --- a/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs +++ b/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs @@ -21,7 +21,7 @@ namespace System.Threading.Tasks // it completed successfully. Return its inner task to avoid unnecessary wrapping, or if the inner // task is null, return a canceled task to match the same semantics as CreateUnwrapPromise. return - !task.IsRanToCompletion ? Task.CreateUnwrapPromise<VoidTaskResult>(task, lookForOce: false) : + !task.IsCompletedSuccessfully ? Task.CreateUnwrapPromise<VoidTaskResult>(task, lookForOce: false) : task.Result ?? Task.FromCanceled(new CancellationToken(true)); } @@ -40,7 +40,7 @@ namespace System.Threading.Tasks // it completed successfully. Return its inner task to avoid unnecessary wrapping, or if the inner // task is null, return a canceled task to match the same semantics as CreateUnwrapPromise. return - !task.IsRanToCompletion ? Task.CreateUnwrapPromise<TResult>(task, lookForOce: false) : + !task.IsCompletedSuccessfully ? Task.CreateUnwrapPromise<TResult>(task, lookForOce: false) : task.Result ?? Task.FromCanceled<TResult>(new CancellationToken(true)); } |