Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/referencesource/mscorlib/system/runtime')
-rw-r--r--mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs b/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs
index fa6b3d92ca8..5c6833f33e7 100644
--- a/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs
+++ b/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs
@@ -825,16 +825,28 @@ namespace System.Runtime.CompilerServices
// so that they won't "leak" out of the first await.
Thread currentThread = Thread.CurrentThread;
+#if MONO
+ ExecutionContext.Switcher ecs = default (ExecutionContext.Switcher);
+#else
ExecutionContextSwitcher ecs = default(ExecutionContextSwitcher);
+#endif
RuntimeHelpers.PrepareConstrainedRegions();
try
{
+#if MONO
+ currentThread.BranchExecutionContext (out ecs);
+#else
ExecutionContext.EstablishCopyOnWriteScope(currentThread, false, ref ecs);
+#endif
stateMachine.MoveNext();
}
finally
{
+#if MONO
+ currentThread.RestoreExecutionContext (ref ecs);
+#else
ecs.Undo(currentThread);
+#endif
}
}