Groups | Blog | Home
all groups > c# > march 2007 >

c# : detecting object lock?


Göran_Andersson
3/10/2007 4:49:29 PM
[quoted text, click to view]

You can use Monitor.TryEnter(theObject) to try to use the object in a
lock. If it returns false, the object is already used in a lock. If it
returns true, you have successfully used it in a lock.

Note: Using an object in a lock doesn't protect the object in any way,
it only stops any other code to use the same object in a lock.

--
Göran Andersson
_____
Hyun-jik Bae
3/10/2007 11:12:26 PM
Is there any way knowing if an object is locked, for example, "lock(object)
{...}" ?

Please reply. Thanks in advance.

Hyun-jik Bae

AddThis Social Bookmark Button