gitwtfhub

wtf is asyncex?

stephencleary/asyncex — explained in plain English

Analysis updated 2026-07-03

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

TL;DR

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

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

Why would anyone build with this?

REASON 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.

REASON 2

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

REASON 3

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

REASON 4

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

What's in the stack?

C#.NET StandardNuGetXamarin

How it stacks up

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 spin it up?

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

Wtf does this do

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.

Yoink these 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

wtf 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.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.