Hi All,
I am using Mutex in a multithreaded application where each threads trying to acquire mutex with same name.
My code looks like
Mutex mutex = null;
string mutexName = "getMutex";
try {
mutex = Mutex.OpenExisting(mutexName);
}
catch (Exception e) {
mutex = new Mutex(false, mutexName);
}
for first thread it runs good but when second thread come and try to execute it it throws an exception and returns.
Exception:
Access to the path 'getMutex' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
when i checked on MSDN it show that it may throw UnauthorizedAccessException but don't know how to resolve it and work and why it throw this exception when Mutex object is thread of same user.
Thanks,