Quick Mutex Question

From: dln (dnadon_nospm_at_hotmail.com)
Date: 04/13/04


Date: Tue, 13 Apr 2004 11:09:55 -0500

If I were to use the following call:

Mutex my_mutex = new Mutex();
bool got_lock = my_mutex.WaitOne(500, false);

and then got_lock returns false, do I need to call "my_mutex.ReleaseMutex()"
on it? So put another way, should I always call ReleaseMutex, regardless of
whether or not I got the lock?

Thanks.



Relevant Pages

  • Re: Mutex not working for CAO
    ... again when a lock is created and it has no collection for outstanding locks. ... BTW - do you need a mutex or could you use a Monitor/Lock? ... object if multiple threads call into this class. ... public bool LockObject ...
    (microsoft.public.dotnet.framework.remoting)
  • NamedMutex with SECURITY_ATTRIBUTES
    ... service is able to create the mutex but my user app gets ... > private bool InternalReleaseMutex() ... > private static extern bool ReleaseMutex(IntPtr ... > public uint Owner; ...
    (microsoft.public.dotnet.framework.interop)
  • Re: why UI gets hangs
    ... It isn't a semaphore; ... The wiki author calls it a 'binary semaphore', better known as a mutex. ... It is a bool variable, and as such, it's just dumb data. ... don't necessarily share a completely consistent view of memory. ...
    (microsoft.public.vc.mfc)
  • Re: [PATCH 7/7] [RFC] APM emulation driver for class batteries
    ... Utterly unsafe. ... APM interface needs a mutex. ... Just mark it bool, when you fix it with mutex, you can go back to ... tristate. ...
    (Linux-Kernel)
  • Re: weird /strange???
    ... //MyData is protected using Mutex, b1=true here by using Visual Studio ... Never compare a boolean value with true, ... The older Windows typedef BOOL is a redefinition of an integer, ...
    (microsoft.public.vc.mfc)