.NET Matters: Stream Pipeline

My latest .NET Matters column in MSDN Magazine is now available online.  In it, I discuss one approach to implementing a BlockingStream and using it to implement a StreamPipeline class.


Parallel Extensions CTP!

For those of you who haven’t heard, we released a CTP of the Parallel Extensions to the .NET Framework.  You can download it here, and you can learn more about it in the new Parallel Computing dev center on MSDN, as well as from the Parallel Extensions team blog.  Enjoy! -Steve


.NET Matters: Deadlock Monitor

My latest .NET Matters in MSDN Magazine is now online here.  In it, I discuss what deadlocks are and ways to detect them when using monitors.


Handling window messages in console apps

If you’ve ever wondered how to handle window messages in .NET console applications, check out my latest .NET Matters column in the June 2007 issue of MSDN Magazine, which just went online an hour or so ago.


Slides and code from DevConnections talks

Several folks have asked me for my slides and code samples from both talks I gave at Visual Studio Connections last week.  You can find them here:http://www.devconnections.com/updates/LasVegasFall_06/VS_Connections/Toub_VGN305_VSConnections_Fall2006.ziphttp://www.devconnections.com/updates/LasVegasFall_06/VS_Connections/Toub_VMU302_VSConnections_Fall2006.zip


Bounded blocking queues

In my last post, I took a look at implementing blocking queues in .NET using semaphores (both System.Threading.Semaphore and a managed semaphore implementation).  I defined a blocking queue as one that blocked on a dequeue operation until an item could successfully be removed from the queue, rather than throwing an exception if no items exist…


Blocking queues

In many concurrent systems, one thread performs some work, the result of which another thread consumes. This producer/consumer pattern is frequently implemented on top of blocking queues. If you examine the behavior of System.Collections.Queue and System.Collections.Generic.Queue<T>, you’ll find that they both throw InvalidOperationException from the Dequeue method (which attempts to remove and return an item…


Randomness bugs

Some of the hardest bugs to discover are those involved in features that contain intentionally random behavior. Sudoku was originally written using System.Random as its source of randomness. As is described in the article about its development, this randomness is used during any brute-force steps taken by the puzzle solver, and as the solver is…


When (a+b)+c != a+(b+c)…

In a discussion of C# this weekend, someone said (a+(b+c)) is the same as ((a+b)+c) when a,b,c are all primitive data types, like int, float, double, etc. In pure math, sure.  In code, not necessarily. First consider System.Int32 and the following example test.cs: using System;class Program{    static void Main(string[] args)    {        int a = int.MaxValue;        int b…