.NET Parallel Programming

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

Awaiting Socket Operations

The System.Net.Sockets.Socket class in .NET exposes multiple sets of asynchronous methods that perform the same basic operations but that are exposed with different patterns.The first set follows the APM pattern, where for a synchronous method like Receive, the BeginReceive and EndReceive methods are exposed.  If you want to be able to &...

Paper :: Guide to Implementing Custom TPL Dataflow Blocks

TPL Dataflow includes a number of built-in, already-implemented blocks that target the most common scenarios.  Additionally, some flexibility is provided by the set of options that may be used to tweak block behaviors.  However, a developer may still choose to implement a custom block for advanced scenarios where the built-in ones ...

Coalescing CancellationTokens from Timeouts

In the .NET Framework 4.5 Developer Preview, you’ll find that CancellationTokenSource now has timeout support built directly into its implementation.  This makes it very easy to create a token that will automatically have cancellation requested after a particular time interval, e.g. public static CancellationToken FromTimeout(int ...