Hyun-jik Bae wrote:
Is there any way knowing if an object is locked, for example, "lock(object)
{...}" ?
Please reply. Thanks in advance.
Hyun-jik Bae
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
_____
http://www.guffa.com