TimedLock revisited

In an earlier blog entry, I asked the question if it made sense to add code in a debug version of the TimedLock class (written by Ian Griffiths in this post and commented on by Eric Gunnerson in this post) to store the stack trace when acquiring a lock on an object so that if another thread blocks an attempt to acquire a TimedLock, we can discover the StackTrace of the blocking thread.

Well I stopped asking questions and started writing answers. I update the TimedLock class with stack trace tracking and also wrote an NUnit test that demonstrates the fact that we can identify the stack trace. Download the source code here.

Please keep in mind, this is meant to be a DEBUG version. In order to store the stack trace, I place it and the object being locked into a static hash table. In doing so, I acquire a lock on the hash table which can hinder overall concurrency as it is a static member. Hopefully, this will still be useful for tracking a pesky deadlock issue. I haven't done any serious analysis or testing yet, so I welcome your comments if I'm way off base.

Technorati Tags: ,

What others have said

Requesting Gravatar... nospamplease75@yahoo.com (Haacked) Apr 21, 2004 9:36 AM
# RE: TimedLock revisited
Ian Griffiths found a few minor issues with my implementation. I'll try to fix them soon and post the changes. Just a bit of sloppiness on my part. I will lash myself twenty times for penance.
Requesting Gravatar... Ian Griffiths Apr 28, 2004 12:41 AM
# re: TimedLock revisited
Trackback doesn't appear to be working, so I thought I'd better post manually... I've got an update on this article:

http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking
Requesting Gravatar... you've been HAACKED May 11, 2004 6:25 PM
# TimedLock Yet Again Revisited...

What do you have to say?

(will show your gravatar)
Please add 7 and 6 and type the answer here: