Table of Contents

Class SingleThreadSynchronizationContext

Namespace
CarinaStudio.Threading
Assembly
CarinaStudio.AppBase.Core.dll

Implementation of SynchronizationContext which uses single execution thread to handle posted call-backs. This is thread-safe class.

public class SingleThreadSynchronizationContext : SynchronizationContext, IDisposable
Inheritance
SingleThreadSynchronizationContext
Implements
Inherited Members
Extension Methods

Constructors

SingleThreadSynchronizationContext(string?, bool)

Initialize new SingleThreadSynchronizationContext instance.

public SingleThreadSynchronizationContext(string? name = null, bool isBackground = true)

Parameters

name string

Name.

isBackground bool

True to set execution thread as background.

Properties

ExecutionThread

Get execution thread.

public Thread ExecutionThread { get; }

Property Value

Thread

Name

Get name.

public string? Name { get; }

Property Value

string

Methods

Dispose()

Dispose the instance.

public void Dispose()

Post(SendOrPostCallback, object?)

Post a call-back.

public override void Post(SendOrPostCallback callback, object? state)

Parameters

callback SendOrPostCallback

Call-back.

state object

Custom state passed to call-back.

Send(SendOrPostCallback, object?)

Send a call-back and wait for execution completed.

public override void Send(SendOrPostCallback callback, object? state)

Parameters

callback SendOrPostCallback

Call-back.

state object

Custom state passed to call-back.