In the previous post I showed how to simulate async/await in .NET 4.0. This works great for Task-based async, but what about those who still use stone tools and .NET 3.5? Well, they can share in the fun, too! I…
Just can’t [a]wait (in 4.0)
Writing managed asynchronous code has been possible since the advent of IAsyncResult in .NET 1.0. However, it has not been easy until async/await in .NET 4.5. Unfortunately, there are situations where you really need to implement asynchrony but are stuck…
If at first you don’t succeed
Retries are a fact of life in testing. That file you are trying to read might be temporarily locked. The network connection could momentarily break. You may need to keep pinging a server for status until it returns the result…
Porting InputQueue to C++
In the previous post, I gave a brief intro to the PPL and the basic constructs for writing async C++ code. In this post, I will discuss the highlights of how I ported the InputQueue sample to C++ using the…
InputQueue, the non-BlockingCollection
The .NET 4.0+ solution to the producer-consumer problem is BlockingCollection. A sample app with a single producer and consumer using an ordered queue of integers would look something like this: This is simple enough, but the problem is that DequeueLoop.…
Better tracing with EventSource
Starting in .NET 4.5, managed code developers finally have a simple way to interact with ETW — System.Diagnostics.Tracing.EventSource. For a quick introduction, check out Vance Morrison’s inaugural blog post on EventSource and the also very helpful feature specification. While EventSource…
Async Process functionality – take 2
In my previous post, I showed a simple way to add a few Task-based async methods for dealing with System.Diagnostics.Process. The code I showed, while simple, has some flaws: It has low cohesion. In violation of the single responsibility principle,…
More about asynchronous cleanup
In a previous post, I showed some sample code to implement a UsingAsync method to handle async cleanup. This is a useful pattern but it starts to break down as the number of items to be cleaned up grows beyond…
Real-time trace sessions with TraceEvent
ETW log files are great for post-mortem debugging and analysis. But did you know that you can actually process ETW event streams in (near) real-time without log files at all? It’s true! Real-time event consumption has historically been accessible only…
Async fixed concurrency workflows
In the previous post, I mentioned async fixed concurrency workflows as providing the best balance between resource utilization, latency, and throughput. Let’s explore two ways to build such a workflow. Single-threaded workflow The first design we will look at involves…