This seems to be my favorite geek subject, but I have to tell you a success story using Ian Griffith’s Timed Lock struct with my enhancement.

To recap, when you fail to acquire a lock on an object because another thread already has one, my enhancement allows you to see the stack trace of the blocking thread. Well the other day, I was running a suite of unit tests against a socket server I was building when one of the tests failed with a ThreadTimeoutException. Looking at the stack trace, I found the line of code where another thread was unnecessarily holding a lock on the object. I used to spend a lot of time poring through logs trying to decipher threading issues such as this.