summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2017-10-06 20:25:43 -0400
committerGitHub <noreply@github.com>2017-10-06 20:25:43 -0400
commit273b482fd0345de3dadad6fee4544517b2b8de62 (patch)
treedb1f469b2fd858fcec5cfb7ed8fa222ecd9b6f10 /src
parent5fed4faadbdb99a1774c1921ece0e8408643ba10 (diff)
parent702670e3040fa2c49782da16409e557409ada445 (diff)
downloadcoreclr-273b482fd0345de3dadad6fee4544517b2b8de62.tar.gz
coreclr-273b482fd0345de3dadad6fee4544517b2b8de62.tar.bz2
coreclr-273b482fd0345de3dadad6fee4544517b2b8de62.zip
Merge pull request #14369 from stephentoub/fix_cont_handling
Fix handling of continuations for captured context
Diffstat (limited to 'src')
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/Task.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mscorlib/src/System/Threading/Tasks/Task.cs b/src/mscorlib/src/System/Threading/Tasks/Task.cs
index e3dd01c0a9..aed2c3b2be 100644
--- a/src/mscorlib/src/System/Threading/Tasks/Task.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/Task.cs
@@ -2644,10 +2644,10 @@ namespace System.Threading.Tasks
SynchronizationContext syncCtx = SynchronizationContext.CurrentNoFlow;
if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext))
{
- Action moveNextAction = stateMachineBox.MoveNextAction;
- if (!AddTaskContinuation(new SynchronizationContextAwaitTaskContinuation(syncCtx, moveNextAction, flowExecutionContext: false), addBeforeOthers: false))
+ var tc = new SynchronizationContextAwaitTaskContinuation(syncCtx, stateMachineBox.MoveNextAction, flowExecutionContext: false);
+ if (!AddTaskContinuation(tc, addBeforeOthers: false))
{
- AwaitTaskContinuation.UnsafeScheduleAction(moveNextAction, this);
+ tc.Run(this, canInlineContinuationTask: false);
}
return;
}
@@ -2656,10 +2656,10 @@ namespace System.Threading.Tasks
TaskScheduler scheduler = TaskScheduler.InternalCurrent;
if (scheduler != null && scheduler != TaskScheduler.Default)
{
- Action moveNextAction = stateMachineBox.MoveNextAction;
- if (!AddTaskContinuation(new TaskSchedulerAwaitTaskContinuation(scheduler, moveNextAction, flowExecutionContext: false), addBeforeOthers: false))
+ var tc = new TaskSchedulerAwaitTaskContinuation(scheduler, stateMachineBox.MoveNextAction, flowExecutionContext: false);
+ if (!AddTaskContinuation(tc, addBeforeOthers: false))
{
- AwaitTaskContinuation.UnsafeScheduleAction(moveNextAction, this);
+ tc.Run(this, canInlineContinuationTask: false);
}
return;
}