Code samples from my book Multithreading in C# 5.0 Cookbook