PC Review


Reply
Thread Tools Rate Thread

Check if resourse is locked

 
 
bg_ie@yahoo.com
Guest
Posts: n/a
 
      18th Jan 2007
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.

 
Reply With Quote
 
 
 
 
Michael Nemtsev
Guest
Posts: n/a
 
      18th Jan 2007
Hello (E-Mail Removed),

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

---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

> 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.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if resourse is locked bg_ie@yahoo.com Microsoft C# .NET 1 18th Jan 2007 07:37 PM
Check if resourse is locked bg_ie@yahoo.com Microsoft C# .NET 0 18th Jan 2007 04:32 PM
how to spell check in locked form so those filling out can check s =?Utf-8?B?Skw=?= Microsoft Word Document Management 1 18th Nov 2005 02:24 AM
Can spell check be set to check when a form is locked? =?Utf-8?B?U3VzYW4gUmljZQ==?= Microsoft Word Document Management 2 5th Nov 2005 04:30 AM
Resourse DLL Ton. Microsoft Windows 2000 Deployment 0 29th Apr 2004 03:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:31 AM.