HighTechTalks DotNet Forums  

Need clarification on Mutex.WaitOne method.

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss Need clarification on Mutex.WaitOne method. in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ken Varn
 
Posts: n/a

Default Need clarification on Mutex.WaitOne method. - 10-31-2006 , 04:49 PM






If I have a thread that calls WaitOne() on a Mutex object with no arguments,
is the Mutex owned by the calling thread once the WaitOne() call returns?

The documentation states that when no arguments are passed to WaitOne() that
it translates to a WaitOne(-1,false) call.

I am confused about the bool argument of the Mutex. If false is passed to a
WaitOne call, is the mutex then acquired by the calling thread or does it
just indicate that the mutex is now free, but not acquired?



--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------



Reply With Quote
  #2  
Old   
Jon Shemitz
 
Posts: n/a

Default Re: Need clarification on Mutex.WaitOne method. - 10-31-2006 , 05:00 PM






Ken Varn wrote:

Quote:
If I have a thread that calls WaitOne() on a Mutex object with no arguments,
is the Mutex owned by the calling thread once the WaitOne() call returns?
Yes.

Quote:
I am confused about the bool argument of the Mutex. If false is passed to a
WaitOne call, is the mutex then acquired by the calling thread or does it
just indicate that the mutex is now free, but not acquired?
No. The boolean parameter is for use with a ContextBoundObject. That's
a complex subject, and odds are good that you'd know if you were using
a ContextBoundObject if you were.

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.


Reply With Quote
  #3  
Old   
Jon Shemitz
 
Posts: n/a

Default Re: Need clarification on Mutex.WaitOne method. - 10-31-2006 , 06:03 PM



Grr.

Quote:
odds are good that you'd know if you were using
a ContextBoundObject if you were.
s/b "odds are good that you'd know you were using a ContextBoundObject
if you were."


--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.