mscorlib(4.0.0.0) API with additions
System.Threading.SynchronizationContext Class Reference

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

Public Member Functions

 SynchronizationContext ()
 Creates a new instance of the T:System.Threading.SynchronizationContext class. More...
 
bool IsWaitNotificationRequired ()
 Determines if wait notification is required. More...
 
virtual void Send (SendOrPostCallback d, object state)
 When overridden in a derived class, dispatches a synchronous message to a synchronization context. More...
 
virtual void Post (SendOrPostCallback d, object state)
 When overridden in a derived class, dispatches an asynchronous message to a synchronization context. More...
 
virtual void OperationStarted ()
 When overridden in a derived class, responds to the notification that an operation has started. More...
 
virtual void OperationCompleted ()
 When overridden in a derived class, responds to the notification that an operation has completed. More...
 
virtual int Wait (IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
 Waits for any or all the elements in the specified array to receive a signal. More...
 
virtual SynchronizationContext CreateCopy ()
 When overridden in a derived class, creates a copy of the synchronization context. More...
 

Static Public Member Functions

static void SetSynchronizationContext (SynchronizationContext syncContext)
 Sets the current synchronization context. More...
 

Protected Member Functions

void SetWaitNotificationRequired ()
 Sets notification that wait notification is required and prepares the callback method so it can be called more reliably when a wait occurs. More...
 
static int WaitHelper (IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
 Helper function that waits for any or all the elements in the specified array to receive a signal. More...
 

Properties

static SynchronizationContext?? Current [get]
 Gets the synchronization context for the current thread. More...
 

Detailed Description

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

Definition at line 12 of file SynchronizationContext.cs.

Constructor & Destructor Documentation

◆ SynchronizationContext()

System.Threading.SynchronizationContext.SynchronizationContext ( )

Creates a new instance of the T:System.Threading.SynchronizationContext class.

Definition at line 54 of file SynchronizationContext.cs.

Member Function Documentation

◆ CreateCopy()

virtual SynchronizationContext System.Threading.SynchronizationContext.CreateCopy ( )
virtual

When overridden in a derived class, creates a copy of the synchronization context.

Returns
A new T:System.Threading.SynchronizationContext object.

Definition at line 219 of file SynchronizationContext.cs.

◆ IsWaitNotificationRequired()

bool System.Threading.SynchronizationContext.IsWaitNotificationRequired ( )

Determines if wait notification is required.

Returns
true if wait notification is required; otherwise, false.

Definition at line 93 of file SynchronizationContext.cs.

◆ OperationCompleted()

virtual void System.Threading.SynchronizationContext.OperationCompleted ( )
virtual

When overridden in a derived class, responds to the notification that an operation has completed.

Definition at line 125 of file SynchronizationContext.cs.

◆ OperationStarted()

virtual void System.Threading.SynchronizationContext.OperationStarted ( )
virtual

When overridden in a derived class, responds to the notification that an operation has started.

Definition at line 119 of file SynchronizationContext.cs.

◆ Post()

virtual void System.Threading.SynchronizationContext.Post ( SendOrPostCallback  d,
object  state 
)
virtual

When overridden in a derived class, dispatches an asynchronous message to a synchronization context.

Parameters
dThe T:System.Threading.SendOrPostCallback delegate to call.
stateThe object passed to the delegate.

Definition at line 112 of file SynchronizationContext.cs.

◆ Send()

virtual void System.Threading.SynchronizationContext.Send ( SendOrPostCallback  d,
object  state 
)
virtual

When overridden in a derived class, dispatches a synchronous message to a synchronization context.

Parameters
dThe T:System.Threading.SendOrPostCallback delegate to call.
stateThe object passed to the delegate.
Exceptions
T:System.NotSupportedExceptionThe method was called in a Windows Store app. The implementation of T:System.Threading.SynchronizationContext for Windows Store apps does not support the M:System.Threading.SynchronizationContext.Send(System.Threading.SendOrPostCallback,System.Object) method.

Definition at line 103 of file SynchronizationContext.cs.

◆ SetSynchronizationContext()

static void System.Threading.SynchronizationContext.SetSynchronizationContext ( SynchronizationContext  syncContext)
static

Sets the current synchronization context.

Parameters
syncContextThe T:System.Threading.SynchronizationContext object to be set.

Definition at line 166 of file SynchronizationContext.cs.

◆ SetWaitNotificationRequired()

void System.Threading.SynchronizationContext.SetWaitNotificationRequired ( )
protected

Sets notification that wait notification is required and prepares the callback method so it can be called more reliably when a wait occurs.

Definition at line 60 of file SynchronizationContext.cs.

◆ Wait()

virtual int System.Threading.SynchronizationContext.Wait ( IntPtr []  waitHandles,
bool  waitAll,
int  millisecondsTimeout 
)
virtual

Waits for any or all the elements in the specified array to receive a signal.

Parameters
waitHandlesAn array of type T:System.IntPtr that contains the native operating system handles.
waitAlltrue to wait for all handles; false to wait for any handle.
millisecondsTimeoutThe number of milliseconds to wait, or F:System.Threading.Timeout.Infinite (-1) to wait indefinitely.
Returns
The array index of the object that satisfied the wait.
Exceptions
T:System.ArgumentNullExceptionwaitHandles is null.

Definition at line 140 of file SynchronizationContext.cs.

◆ WaitHelper()

static int System.Threading.SynchronizationContext.WaitHelper ( IntPtr []  waitHandles,
bool  waitAll,
int  millisecondsTimeout 
)
protected

Helper function that waits for any or all the elements in the specified array to receive a signal.

Parameters
waitHandlesAn array of type T:System.IntPtr that contains the native operating system handles.
waitAlltrue to wait for all handles; false to wait for any handle.
millisecondsTimeoutThe number of milliseconds to wait, or F:System.Threading.Timeout.Infinite (-1) to wait indefinitely.
Returns
The array index of the object that satisfied the wait.

Property Documentation

◆ Current

SynchronizationContext?? System.Threading.SynchronizationContext.Current
staticget

Gets the synchronization context for the current thread.

Returns
A T:System.Threading.SynchronizationContext object representing the current synchronization context.

Definition at line 35 of file SynchronizationContext.cs.


The documentation for this class was generated from the following file: