using System; using System.Runtime.Serialization; using System.Security; namespace System.Threading { /// Manages the execution context for the current thread. This class cannot be inherited. /// 2 // Token: 0x0200060E RID: 1550 [Serializable] public sealed class ExecutionContext : ISerializable { // Token: 0x060038A0 RID: 14496 RVA: 0x000C40BC File Offset: 0x000C22BC internal ExecutionContext() { } // Token: 0x060038A1 RID: 14497 RVA: 0x000C40C4 File Offset: 0x000C22C4 internal ExecutionContext(ExecutionContext ec) { if (ec._sc != null) { this._sc = new SecurityContext(ec._sc); } this._suppressFlow = ec._suppressFlow; this._capture = true; } // Token: 0x060038A2 RID: 14498 RVA: 0x000C40FC File Offset: 0x000C22FC [MonoTODO] internal ExecutionContext(SerializationInfo info, StreamingContext context) { throw new NotImplementedException(); } /// Captures the execution context from the current thread. /// An object representing the execution context for the current thread. /// 1 // Token: 0x060038A3 RID: 14499 RVA: 0x000C410C File Offset: 0x000C230C public static ExecutionContext Capture() { ExecutionContext executionContext = Thread.CurrentThread.ExecutionContext; if (executionContext.FlowSuppressed) { return null; } ExecutionContext executionContext2 = new ExecutionContext(executionContext); if (SecurityManager.SecurityEnabled) { executionContext2.SecurityContext = SecurityContext.Capture(); } return executionContext2; } /// Creates a copy of the current execution context. /// An object representing the current execution context. /// This context cannot be copied because it is used. Only newly captured contexts can be copied. /// 2 // Token: 0x060038A4 RID: 14500 RVA: 0x000C4150 File Offset: 0x000C2350 public ExecutionContext CreateCopy() { if (!this._capture) { throw new InvalidOperationException(); } return new ExecutionContext(this); } /// Sets the specified object with the logical context information needed to recreate an instance of the current execution context. /// The object to be populated with serialization information. /// The structure representing the destination context of the serialization. /// /// is null. /// 2 // Token: 0x060038A5 RID: 14501 RVA: 0x000C416C File Offset: 0x000C236C [MonoTODO] public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } throw new NotImplementedException(); } // Token: 0x17000AFF RID: 2815 // (get) Token: 0x060038A6 RID: 14502 RVA: 0x000C4184 File Offset: 0x000C2384 // (set) Token: 0x060038A7 RID: 14503 RVA: 0x000C41A4 File Offset: 0x000C23A4 internal SecurityContext SecurityContext { get { if (this._sc == null) { this._sc = new SecurityContext(); } return this._sc; } set { this._sc = value; } } // Token: 0x17000B00 RID: 2816 // (get) Token: 0x060038A8 RID: 14504 RVA: 0x000C41B0 File Offset: 0x000C23B0 // (set) Token: 0x060038A9 RID: 14505 RVA: 0x000C41B8 File Offset: 0x000C23B8 internal bool FlowSuppressed { get { return this._suppressFlow; } set { this._suppressFlow = value; } } /// Indicates whether the flow of the execution context is currently suppressed. /// true if the flow is suppressed; otherwise, false. /// 1 // Token: 0x060038AA RID: 14506 RVA: 0x000C41C4 File Offset: 0x000C23C4 public static bool IsFlowSuppressed() { return Thread.CurrentThread.ExecutionContext.FlowSuppressed; } /// Restores the flow of the execution context across asynchronous threads. /// The context flow cannot be restored because it is not being suppressed. /// 1 // Token: 0x060038AB RID: 14507 RVA: 0x000C41D8 File Offset: 0x000C23D8 public static void RestoreFlow() { ExecutionContext executionContext = Thread.CurrentThread.ExecutionContext; if (!executionContext.FlowSuppressed) { throw new InvalidOperationException(); } executionContext.FlowSuppressed = false; } /// Runs a method in a specified execution context on the current thread. /// The to set. /// A delegate that represents the method to be run in the provided execution context. /// The object to pass to the callback method. /// /// is null.-or- was not acquired through a capture operation. -or- has already been used as the argument to a call. /// 1 /// /// /// // Token: 0x060038AC RID: 14508 RVA: 0x000C4208 File Offset: 0x000C2408 [MonoTODO("only the SecurityContext is considered")] public static void Run(ExecutionContext executionContext, ContextCallback callback, object state) { if (executionContext == null) { throw new InvalidOperationException(Locale.GetText("Null ExecutionContext")); } SecurityContext.Run(executionContext.SecurityContext, callback, state); } /// Suppresses the flow of the execution context across asynchronous threads. /// An structure for restoring the flow. /// The context flow is already suppressed. /// 1 /// /// /// // Token: 0x060038AD RID: 14509 RVA: 0x000C4230 File Offset: 0x000C2430 public static AsyncFlowControl SuppressFlow() { Thread currentThread = Thread.CurrentThread; currentThread.ExecutionContext.FlowSuppressed = true; return new AsyncFlowControl(currentThread, AsyncFlowControlType.Execution); } // Token: 0x040016E8 RID: 5864 private SecurityContext _sc; // Token: 0x040016E9 RID: 5865 private bool _suppressFlow; // Token: 0x040016EA RID: 5866 private bool _capture; } }