.NET Parallel Programming

All about Async/Await, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more…

Building Async Coordination Primitives, Part 5: AsyncSemaphore

In my last few posts, I covered building an AsyncManualResetEvent, an AsyncAutoResetEvent, an AsyncCountdownEvent, and an AsyncBarrier.  In this post, I’ll cover building an AsyncSemaphore class.Semaphores have a wide range of applicability.  They’re great for throttling, for protected access to a limited set of resources...

Building Async Coordination Primitives, Part 3: AsyncCountdownEvent

In my last two posts, I discussed building AsyncManualResetEvent and AsyncAutoResetEvent coordination primitives.  In this post, I’ll build on that to create a simple AsyncCountdownEvent.A countdown event is an event that will allow waiters to complete after receiving a particular number of signals.  The “countdown&rdquo...

Building Async Coordination Primitives, Part 2: AsyncAutoResetEvent

In my last post, I discussed building an asynchronous version of a manual-reset event.  This time, we’ll build an asynchronous version of an auto-reset event.A manual-reset event is transitioned to the signaled state when requested to do so (i.e. calling Set()), and then it remains in that state until it’s manually ...

Building Async Coordination Primitives, Part 1: AsyncManualResetEvent

The Task-based Async Pattern (TAP) isn’t just about asynchronous operations that you initiate and then asynchronously wait for to complete.  More generally, tasks can be used to represent all sorts of happenings, enabling you to await for any matter of condition to occur.  We can even use Tasks to build simple coordination ...