summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Threading/ExecutionContext.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Threading/ExecutionContext.cs')
-rw-r--r--src/mscorlib/src/System/Threading/ExecutionContext.cs62
1 files changed, 5 insertions, 57 deletions
diff --git a/src/mscorlib/src/System/Threading/ExecutionContext.cs b/src/mscorlib/src/System/Threading/ExecutionContext.cs
index 5ea9942f65..47a55a3bb9 100644
--- a/src/mscorlib/src/System/Threading/ExecutionContext.cs
+++ b/src/mscorlib/src/System/Threading/ExecutionContext.cs
@@ -19,7 +19,6 @@ namespace System.Threading
using System.Reflection;
using System.Runtime.ExceptionServices;
using System.Runtime.Serialization;
- using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
@@ -27,7 +26,6 @@ namespace System.Threading
using System.Diagnostics.Contracts;
using System.Diagnostics.CodeAnalysis;
- [System.Runtime.InteropServices.ComVisible(true)]
public delegate void ContextCallback(Object state);
internal struct ExecutionContextSwitcher
@@ -55,7 +53,7 @@ namespace System.Threading
[Serializable]
public sealed class ExecutionContext : IDisposable, ISerializable
{
- private static readonly ExecutionContext Default = new ExecutionContext();
+ internal static readonly ExecutionContext Default = new ExecutionContext();
private readonly IAsyncLocalValueMap m_localValues;
private readonly IAsyncLocal[] m_localChangeNotifications;
@@ -93,16 +91,10 @@ namespace System.Threading
public static ExecutionContext Capture()
{
ExecutionContext executionContext = Thread.CurrentThread.ExecutionContext;
- if (executionContext == null)
- {
- return Default;
- }
- if (executionContext.m_isFlowSuppressed)
- {
- // Prevent ExecutionContext.Run on a suppressed-flow context for desktop framework compatibility
- return null;
- }
- return executionContext;
+ return
+ executionContext == null ? Default :
+ executionContext.m_isFlowSuppressed ? null :
+ executionContext;
}
private ExecutionContext ShallowClone(bool isFlowSuppressed)
@@ -301,38 +293,6 @@ namespace System.Threading
}
}
- #region Wrappers for CLR compat, to avoid ifdefs all over the BCL
-
- [Flags]
- internal enum CaptureOptions
- {
- None = 0x00,
- IgnoreSyncCtx = 0x01,
- OptimizeDefaultCase = 0x02,
- }
-
- internal static ExecutionContext Capture(ref StackCrawlMark stackMark, CaptureOptions captureOptions)
- {
- return Capture();
- }
-
- [FriendAccessAllowed]
- internal static ExecutionContext FastCapture()
- {
- return Capture();
- }
-
- [FriendAccessAllowed]
- internal static void Run(ExecutionContext executionContext, ContextCallback callback, Object state, bool preserveSyncCtx)
- {
- Run(executionContext, callback, state);
- }
-
- internal bool IsDefaultFTContext(bool ignoreSyncCtx)
- {
- return this == Default;
- }
-
public ExecutionContext CreateCopy()
{
return this; // since CoreCLR's ExecutionContext is immutable, we don't need to create copies.
@@ -342,18 +302,6 @@ namespace System.Threading
{
// For CLR compat only
}
-
- internal static ExecutionContext PreAllocatedDefault
- {
- get { return ExecutionContext.Default; }
- }
-
- internal bool IsPreAllocatedDefault
- {
- get { return this == ExecutionContext.Default; }
- }
-
- #endregion
}
public struct AsyncFlowControl : IDisposable