.NET Parallel Programming

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

Implementing a simple ForEachAsync, part 2
Implementing a simple ForEachAsync, part 2
After my previous post, I received several emails and comments from folks asking why I chose to implement ForEachAsync the way I did.  My goal with that post wasn’t to prescribe a particular approach to iteration, but rather to answer a question I’d received… obviously, however, I didn’t provide enough background...
Implementing a simple ForEachAsync
Implementing a simple ForEachAsync
Jon Skeet recently asked me how I might go about implementing the following “asynchronous ForEach” behavior: Given what we now know about SemaphoreSlim from my previous post, here’s one way to achieve this: public static Task ForEachAsync<TSource, TResult>(     this IEnumerable<TSource...
Visual Studio 11 Beta currently incompatible with AsyncCtpLibrary*.dll
Visual Studio 11 Beta currently incompatible with AsyncCtpLibrary*.dll
The C# and Visual Basic compilers implement support for async/await by generating code that utilizes some specific types in the underlying framework.  These types include the “awaiters” used to await things (like Tasks) as well as the “builders” used in handling the lifetime of an async method’s invocation. ...
Comments are closed.0
What’s New for Parallelism in .NET 4.5 Beta
What’s New for Parallelism in .NET 4.5 Beta
At //BUILD/ in September, we blogged about the wealth of new support available for parallelism in the .NET Framework 4.5 Developer Preview.  Since then, we’ve been hard at work on the .NET 4.5 Beta.  With the beta just released, here are a few interesting and related things that are new or have changed since the Developer ...
Building Async Coordination Primitives, Part 7: AsyncReaderWriterLock
Building Async Coordination Primitives, Part 7: AsyncReaderWriterLock
In my last past, we looked at building an AsyncLock in terms of an AsyncSemaphore.  In this post, we’ll build a more advanced construct, an asynchronous reader/writer lock.An asynchronous reader/writer lock is more complicated than any of the previous coordination primitives we’ve created.  It also involves more policy, ...
Building Async Coordination Primitives, Part 6: AsyncLock
Building Async Coordination Primitives, Part 6: AsyncLock
Last time, we looked at building an AsyncSemaphore.  Here, we’ll look at building support for an async mutual exclusion mechanism that supports scoping via ‘using’.As mentioned in the previous post, semaphores are great for throttling and resource management.  You can give a semaphore an initial count of the number ...
Building Async Coordination Primitives, Part 4: AsyncBarrier
Building Async Coordination Primitives, Part 4: AsyncBarrier
Last time, we looked at building an AsyncCountdownEvent.  At the end of the post, I highlighted a common pattern for using such a type, which is for all of the participants to signal and then wait for all of the other participants to signal as well.  This kind of synchronization is typically referred to as a “barrier,” ...
Building Async Coordination Primitives, Part 3: AsyncCountdownEvent
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...