Friday, August 12, 2005

Maintaining thread safety is hard

Even Microsoft's best have issues.. First they mess it up in .Net 1.1, then they rewrite it wrong in .Net 2.0. I wonder if they need another code reviewer. The 2.0 version has three bugs now! First, it will reset the _inTrim flag on any exception, even if it didn't set the flag. Second, it will reset the _inTrim flag right before the second NeedsTrim() check, even if someone else has already set it (and presumably is using that flag). Lastly, it will now silently eat exceptions when trimming. How many times have you seen a catch when a finally was the right thing. Go vote on Ladybug to get this fixed.

No comments: