Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / October 2006

Tip: Looking for answers? Try searching our database.

Need clarification on Mutex.WaitOne method.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Varn - 31 Oct 2006 22:49 GMT
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?

Signature

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

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

Jon Shemitz - 31 Oct 2006 23:00 GMT

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

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

Signature

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

Jon Shemitz - 01 Nov 2006 00:03 GMT
Grr.

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

Signature

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


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.