A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://msdn.microsoft.com/en-us/library/system.threading.executioncontext.aspx below:

ExecutionContext Class (System.Threading) | Microsoft Learn

ExecutionContext Class Definition

Manages the execution context for the current thread. This class cannot be inherited.

public ref class ExecutionContext sealed
public ref class ExecutionContext sealed : IDisposable, System::Runtime::Serialization::ISerializable
public ref class ExecutionContext sealed : System::Runtime::Serialization::ISerializable
public sealed class ExecutionContext
public sealed class ExecutionContext : IDisposable, System.Runtime.Serialization.ISerializable
[System.Serializable]
public sealed class ExecutionContext : System.Runtime.Serialization.ISerializable
[System.Serializable]
public sealed class ExecutionContext : IDisposable, System.Runtime.Serialization.ISerializable
type ExecutionContext = class
type ExecutionContext = class
    interface IDisposable
    interface ISerializable
[<System.Serializable>]
type ExecutionContext = class
    interface ISerializable
[<System.Serializable>]
type ExecutionContext = class
    interface IDisposable
    interface ISerializable
Public NotInheritable Class ExecutionContext
Public NotInheritable Class ExecutionContext
Implements IDisposable, ISerializable
Public NotInheritable Class ExecutionContext
Implements ISerializable
Inheritance
Attributes
Implements

The ExecutionContext class provides a single container for all information relevant to a logical thread of execution. In .NET Framework, this includes security context, call context, and synchronization context. In .NET Core, the security context and call context are not supported, however, the impersonation context and culture would typically flow with the execution context. Also in .NET Core, the synchronization context does not flow with the execution context, whereas in .NET Framework it may in some cases. For more information, see ExecutionContext vs SynchronizationContext.

The ExecutionContext class provides the functionality for user code to capture and transfer this context across user-defined asynchronous points. The common language runtime ensures that the ExecutionContext is consistently transferred across runtime-defined asynchronous points within the managed process.

An execution context is the managed equivalent of a COM apartment. Within an application domain, the entire execution context must be transferred whenever a thread is transferred. This situation occurs during transfers made by the Thread.Start method, most thread pool operations, and Windows Forms thread marshaling through the Windows message pump. It does not occur in unsafe thread pool operations (such as the UnsafeQueueUserWorkItem method), which do not transfer the compressed stack. Wherever the compressed stack flows, the managed principal, synchronization, locale, and user context also flow. The ExecutionContext class provides the Capture and CreateCopy methods to get the execution context and the Run method to set the execution context for the current thread.

An ExecutionContext that is associated with a thread cannot be set on another thread. Attempting to do so will result in an exception being thrown. To propagate the ExecutionContext from one thread to another, make a copy of the ExecutionContext.

Internally, the ExecutionContext stores all data that is associated with the LogicalCallContext. This allows the LogicalCallContext data to be propagated when the ExecutionContext is copied and transferred.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4