Show / Hide Table of Contents

# Class ThreadSynchronizationContext

Provides a SynchronizationContext implementation that can be used in console applications or any thread which doesn't have its own SynchronizationContext.

##### Inheritance

System.Object
System.Threading.SynchronizationContext
ThreadSynchronizationContext

##### Inherited Members

System.Threading.SynchronizationContext.CreateCopy()
System.Threading.SynchronizationContext.OperationCompleted()
System.Threading.SynchronizationContext.OperationStarted()
System.Threading.SynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object)
System.Threading.SynchronizationContext.SetSynchronizationContext(System.Threading.SynchronizationContext)
System.Threading.SynchronizationContext.Current
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace:Microsoft.SqlTools.ServiceLayer.Utility

###### Assembly:Microsoft.SqlTools.ServiceLayer.dll

##### Syntax

    public class ThreadSynchronizationContext : SynchronizationContext

### Methods

| Improve this Doc View Source

#### EndLoop()

Ends the SynchronizationContext message loop.

##### Declaration

    public void EndLoop()

| Improve this Doc View Source

#### Post(SendOrPostCallback, Object)

Posts a request for execution to the SynchronizationContext. This will be executed on the SynchronizationContext's thread.

##### Declaration

    public override void Post(SendOrPostCallback callback, object state)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Threading.SendOrPostCallback | callback | The callback to be invoked on the SynchronizationContext's thread.
System.Object | state | A state object to pass along to the callback when executed through the SynchronizationContext.

##### Overrides

System.Threading.SynchronizationContext.Post(System.Threading.SendOrPostCallback, System.Object)
| Improve this Doc View Source

#### RunLoopOnCurrentThread()

Starts the SynchronizationContext message loop on the current thread.

##### Declaration

    public void RunLoopOnCurrentThread()