Skip to content

Provides a single-threaded synchronization context, which makes it easy to reason about asynchronous code in environments that don't usually provide a synchronization context (for example, console applications).

Notifications You must be signed in to change notification settings

antiufo/Shaman.SingleThreadSynchronizationContext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Shaman.SingleThreadSynchronizationContext

Provides a single-threaded SynchronizationContext for console applications.

Usage

using Shaman.Runtime;

static void Main(string args[])
{
    SingleThreadSynchronizationContext.Run(async () => MainAsync(args));
}
static async Task MainAsync(string args[])
{
    // Tasks awaited here will complete their callbacks on the main thread.
    // This makes it easier to reason about async code (by always using coroutines/async, as opposed to real threading). 
}

About

Provides a single-threaded synchronization context, which makes it easy to reason about asynchronous code in environments that don't usually provide a synchronization context (for example, console applications).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages