Check if resourse is locked



Hi,

I have the following in my com object-

static public uint Time
{
get
{
lock (Channel.staticLockObject)
{
return Channel.time;
}
}

}

Sometimes though I am getting back incorrect values when using Time.
How can I check if Channel.staticLockObject is already locked so that I
can print a debug message?

Thanks for your help,

Barry.

.



Relevant Pages

  • Check if resourse is locked
    ... static public uint Time ... lock ... can print a debug message? ...
    (microsoft.public.dotnet.languages.csharp)
  • Check if resourse is locked
    ... static public uint Time ... lock ... can print a debug message? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Check if resourse is locked
    ... Intoduce new variable, in the scope of lock, and set it to true. ... Another way is to lock via Monitor.Enter and use TryEnter to check whether lock exists ... static public uint Time ...
    (microsoft.public.dotnet.languages.csharp)