Export (0) Print
Expand All
0 out of 7 rated this helpful - Rate this topic

SynchronizationContext Class

Provides the basic functionality for propagating a synchronization context in various synchronization models.

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)
[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.NoFlags|SecurityPermissionFlag.ControlEvidence|SecurityPermissionFlag.ControlPolicy)]
public class SynchronizationContext

The SynchronizationContext type exposes the following members.

  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsSynchronizationContextCreates a new instance of the SynchronizationContext class.
Top
  NameDescription
Public propertyStatic memberSupported by Portable Class LibrarySupported in .NET for Windows Store appsCurrentGets the synchronization context for the current thread.
Top
  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsCreateCopyWhen overridden in a derived class, creates a copy of the synchronization context.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsWaitNotificationRequiredDetermines if wait notification is required.
Protected methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsOperationCompletedWhen overridden in a derived class, responds to the notification that an operation has completed.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsOperationStartedWhen overridden in a derived class, responds to the notification that an operation has started.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsPostWhen overridden in a derived class, dispatches an asynchronous message to a synchronization context.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsSendWhen overridden in a derived class, dispatches a synchronous message to a synchronization context.
Public methodStatic memberSupported in .NET for Windows Store appsSetSynchronizationContextSets the current synchronization context.
Public methodStatic memberSetThreadStaticContext
Protected methodSetWaitNotificationRequiredSets notification that wait notification is required and prepares the callback method so it can be called more reliably when a wait occurs.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodWaitWaits for any or all the elements in the specified array to receive a signal.
Protected methodStatic memberWaitHelperHelper function that waits for any or all the elements in the specified array to receive a signal.
Top

The SynchronizationContext class is a base class that provides a free-threaded context with no synchronization.

The purpose of the synchronization model implemented by this class is to allow the internal asynchronous/synchronous operations of the common language runtime to behave properly with different synchronization models. This model also simplifies some of the requirements that managed applications have had to follow in order to work correctly under different synchronization environments.

Providers of synchronization models can extend this class and provide their own implementations for these methods. 

For more information about synchronization contexts, see the article It's All About the SynchronizationContextin the MSDN Magazine.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft. All rights reserved.