explaingit

stephencleary/asyncex

Analysis updated 2026-07-03

3,715C#Audience · developerComplexity · 2/5Setup · easy

TLDR

AsyncEx is a C# library of async-compatible coordination tools including AsyncLock, AsyncSemaphore, and AsyncReaderWriterLock, filling the gap left by older synchronization primitives that do not work correctly with async and await.

Mindmap

mindmap
  root((AsyncEx))
    What it does
      Async coordination
      C# await compatible
      Concurrent access control
    Key tools
      AsyncLock
      AsyncSemaphore
      AsyncReaderWriterLock
      AsyncCountdownEvent
    Platforms
      .NET 4.6
      .NET Core
      Xamarin iOS Android
      UWP
    Setup
      NuGet package
      Full API docs
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Wrap a critical section of async C# code with AsyncLock so only one task can enter it at a time without blocking the thread.

USE CASE 2

Add a timeout to AsyncLock so a waiting task gives up after a set duration instead of hanging indefinitely.

USE CASE 3

Replace legacy thread-blocking synchronization calls in a .NET app with async-friendly equivalents that work with await.

USE CASE 4

Use AsyncReaderWriterLock to let multiple async tasks read shared data simultaneously while blocking concurrent writers.

What is it built with?

C#.NET StandardNuGetXamarin

How does it compare?

stephencleary/asyncexbuiltbybel/privatezillaextendrealityltd/vrtk
Stars3,7153,7193,719
LanguageC#C#C#
Setup difficultyeasyeasymoderate
Complexity2/51/53/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
License not stated in the explanation.

In plain English

AsyncEx is a helper library for C# developers working with async and await, which are language features that let programs do multiple things at once without freezing up. When you write code that runs asynchronously, you sometimes need tools to coordinate different parts of your program so they do not step on each other, and that coordination is what AsyncEx provides. The most commonly used piece is AsyncLock, which is a way to make sure only one part of your program can enter a section of code at a time. This kind of control is called mutual exclusion, and it is a standard problem in concurrent programming. AsyncEx's version works properly with async and await, which older approaches do not, because the older tools were built before those language features existed. You can also set a timeout so that if a lock is not available within a certain window, the waiting code gives up rather than hanging forever. Beyond AsyncLock, the library includes a full set of coordination tools: AsyncSemaphore, AsyncManualResetEvent, AsyncAutoResetEvent, AsyncConditionVariable, AsyncMonitor, AsyncCountdownEvent, and AsyncReaderWriterLock. Each of these is a standard building block that programmers use to manage timing and access between concurrent tasks, adapted here to work correctly with C#'s async model. The library targets .NET Standard, which means it works across .NET 4.6.NET Core, Xamarin for iOS and Android, and Universal Windows apps. It is distributed as a NuGet package, which is the standard way C# developers add libraries to their projects. The README is brief and points to separate documentation files for the full API details.

Copy-paste prompts

Prompt 1
Show me how to use AsyncEx's AsyncLock in a C# async method to ensure only one task reads from a shared file at a time.
Prompt 2
Write a C# example using AsyncEx's AsyncSemaphore to limit concurrent outbound HTTP requests to three at a time.
Prompt 3
How do I install AsyncEx via NuGet and replace a legacy SemaphoreSlim usage with AsyncSemaphore in an existing .NET project?
Prompt 4
Demonstrate using AsyncEx's AsyncCountdownEvent to await the completion of a fixed number of parallel background tasks before continuing.

Frequently asked questions

What is asyncex?

AsyncEx is a C# library of async-compatible coordination tools including AsyncLock, AsyncSemaphore, and AsyncReaderWriterLock, filling the gap left by older synchronization primitives that do not work correctly with async and await.

What language is asyncex written in?

Mainly C#. The stack also includes C#, .NET Standard, NuGet.

What license does asyncex use?

License not stated in the explanation.

How hard is asyncex to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is asyncex for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub stephencleary on gitmyhub

Verify against the repo before relying on details.