From 85f292edd9dd89131ffbde4ced218ea8ffdc325b Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Fri, 6 Jan 2017 04:36:06 -0800 Subject: [PATCH] Address feedback Commit migrated from https://github.com/dotnet/corefx/commit/e5e6e81816386bed611cb10cfaafa6555c6d66cf --- .../tests/Task/TaskStatusTest.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Threading.Tasks/tests/Task/TaskStatusTest.cs b/src/libraries/System.Threading.Tasks/tests/Task/TaskStatusTest.cs index 4b7a75b4d5f..d1c21b46fe1 100644 --- a/src/libraries/System.Threading.Tasks/tests/Task/TaskStatusTest.cs +++ b/src/libraries/System.Threading.Tasks/tests/Task/TaskStatusTest.cs @@ -177,16 +177,12 @@ namespace System.Threading.Tasks.Tests.Status } // - // If we're still waiting for children our Status should reflect so. For this verification, read the - // parent task's status before the child task's status to make the child task's status more recent, - // since the child task may complete during the status reads. + // If we're still waiting for children our Status should reflect so. For this verification, the + // parent task's status needs to be read before the child task's status (they are volatile loads) to + // make the child task's status more recent, since the child task may complete during the status + // reads. // - TaskStatus taskStatus = _task.Status; - Interlocked.MemoryBarrier(); - TaskStatus childTaskStatus = _childTask.Status; - if (taskStatus != TaskStatus.WaitingForChildrenToComplete && - childTaskStatus != TaskStatus.RanToCompletion && - childTaskStatus != TaskStatus.Faulted) + if (_task.Status != TaskStatus.WaitingForChildrenToComplete && !_childTask.IsCompleted) { Assert.True(false, string.Format("Expecting currrent Task status to be WaitingForChildren but getting {0}", _task.Status.ToString())); }