async/await Tips

There’s been some really good guidance about async/await in the past week or two.  I’ve been tinkering away at this post for a while now—based on presentations I’ve been doing, discussions I’ve had with folks at Microsoft, etc.  Now seems like a good idea to post it. First, it’s important to understand what the "async" keyword really mean.  At face value async doesn’t make a method (anonymous or member) “asynchronous”—the body of the method does that.  What it does mean is that there’s a strong possibility that the body of the method won’t entirely be evaluated when the method returns … Continue reading async/await Tips

Introduction to Productivity Extensions

The .NET Framework has been around since 2002. There are many common classes and methods that have been around a long time. The Framework and the languages used to develop on it have evolved quite a bit since many of these classes and their methods came into existence. Existing classes and methods in the base class library (BCL) could be kept up to date with these technologies, but it’s time consuming and potentially destabilizing to add or change methods after a library has been released and Microsoft generally avoids this unless there’s a really good reason. Generics, for example, came … Continue reading Introduction to Productivity Extensions

Thread synchronization of non-atomic invariants in .NET 4.5

Now that we’ve seen how a singular x86-x64 focus might affect how we can synchronize atomic invariants, let’s look at non-atomic invariants. While an atomic invariant really doesn’t need much in the way of guarding, non-atomic invariants often do.  The rules by which the invariant is correct are often much more complex.  Ensuring an atomic invariant like int, for example is pretty easy: you can’t set it to an invalid value, you just need to make sure the value is visible.  Non-atomic invariants involve data that can’t natively be modified atomically.  The typical case is more than one variable, but … Continue reading Thread synchronization of non-atomic invariants in .NET 4.5