Showing results for async - .NET Blog

Feb 29, 2012
Post comments count0
Post likes count0

What’s New for Parallelism in .NET 4.5 Beta

Stephen Toub - MSFT
Stephen Toub - MSFT

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 Preview re...

.NET Parallel Programming
Feb 12, 2012
Post comments count0
Post likes count3

Building Async Coordination Primitives, Part 7: AsyncReaderWriterLock

Stephen Toub - MSFT
Stephen Toub - MSFT

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, meanin...

.NET Parallel Programming
Feb 12, 2012
Post comments count0
Post likes count3

Building Async Coordination Primitives, Part 6: AsyncLock

Stephen Toub - MSFT
Stephen Toub - MSFT

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 of things to protect, and then ...

.NET Parallel Programming
Feb 12, 2012
Post comments count1
Post likes count1

Building Async Coordination Primitives, Part 5: AsyncSemaphore

Stephen Toub - MSFT
Stephen Toub - MSFT

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, and...

.NET Parallel Programming
Feb 11, 2012
Post comments count0
Post likes count2

Building Async Coordination Primitives, Part 4: AsyncBarrier

Stephen Toub - MSFT
Stephen Toub - MSFT

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,” and oft...

.NET Parallel Programming
Feb 11, 2012
Post comments count0
Post likes count3

Building Async Coordination Primitives, Part 2: AsyncAutoResetEvent

Stephen Toub - MSFT
Stephen Toub - MSFT

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 transitioned bac...

.NET Parallel Programming
Feb 11, 2012
Post comments count9
Post likes count1

Building Async Coordination Primitives, Part 1: AsyncManualResetEvent

Stephen Toub - MSFT
Stephen Toub - MSFT

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

.NET Parallel Programming
Feb 8, 2012
Post comments count0
Post likes count3

Potential pitfalls to avoid when passing around async lambdas

Stephen Toub - MSFT
Stephen Toub - MSFT

One of the really useful capabilities of the new async methods feature in C# and Visual Basic is the ability to write async lambdas and anonymous methods (from here on in this post, I’ll refer to both of these as async lambdas, since the discussion applies equally to both).  This allows you to easily get a delegate to represent an asynch...

.NET Parallel Programming
Feb 7, 2012
Post comments count0
Post likes count1

When “ExecuteSynchronously” doesn’t execute synchronously

Stephen Toub - MSFT
Stephen Toub - MSFT

When creating a task continuation with ContinueWith, developers have the opportunity to provide a TaskContinuationOptions enum value, which could include the TaskContinuationOptions.ExecuteSynchronously flag.  ExecuteSynchronously is a request for an optimization to run the continuation task on the same thread that completed the antecedent tas...

.NET Parallel Programming
Feb 6, 2012
Post comments count0
Post likes count0

FromAsync(asyncResult, …) vs FromAsync(beginMethod, …)

Stephen Toub - MSFT
Stephen Toub - MSFT

The Task Parallel Library (TPL) provides a set of “FromAsync” helper methods that create a Task or a Task<TResult> to represent an invocation of an APM method pair, i.e. BeginXx / EndXx.  There are, however, two different flavors among these overloads: ones that accept an IAsyncResult “asyncResult” as the first pa...

.NET Parallel Programming