Class MutexLock
Provides a wrapper around System.Threading.Mutex that automatically acquires on creating and releases on Dispose().
[MustDisposeResource]
public sealed class MutexLock
- Inheritance
-
objectMutexLock
- Extension Methods
Examples
Instead of lock (_object) { code(); }
for per-process locking use
using (new MutexLock("name") { code(); }
for inter-process locking.
Remarks
Automatically handles System.Threading.AbandonedMutexException with Warn(string, Exception?).
Constructors
MutexLock(string)
Acquires System.Threading.Mutex with name
.
public MutexLock(string name)
Parameters
name
string
Methods
Dispose()
Releases the System.Threading.Mutex.
public void Dispose()
Remarks
Must be called from the same thread that instantiated this object.