I was looking at the Mutex(Boolean, String) page and i’m completely confused. If i pass true how do i check if the mutex is owned by me or now? Then i saw Mutex(Boolean, String, out Boolean) and can use the 3rd param to check.
I’m extremely confused. I tested, new mutex doesnt return null or throw an exception if another process is holding the named mutex. But with the other i can check via paran. So whats the point of that constructor and Mutex(Boolean)?
If you want to create a named mutex, but don’t want to own it, it seems like the ideal overload to use:
(Emphasis added)
If you use the
Mutex(Boolean)constructor creates a local mutex – one not visible outside of your program.It appears that the designers of this class favored consistent parameter ordering in the constructor overloads – some might have designed this particular constructor without the
initiallyOwnedparameter at all – just with thename. But that’s more of a stylistic choice.