I was wondering which of the following options was suggested when using Mutex (or Semaphores or ReadWriteLockSlims, etc.).
If the initial lock occurs inside or outside the try statement? It does not matter?
_mutex.WaitOne()
try
{
}
finally
{
_mutex.ReleaseMutex();
}
or
try
{
_mutex.WaitOne()
}
finally
{
_mutex.ReleaseMutex();
}
source
share