NanoByte.Common
Public Member Functions | List of all members
NanoByte.Common.MutexLock Class Reference

Provides a wrapper around Mutex that automatically acquires on creating and releases on Dispose. More...

Inheritance diagram for NanoByte.Common.MutexLock:

Public Member Functions

 MutexLock (string name)
 Acquires Mutex with name . More...
 
void Dispose ()
 Releases the Mutex. More...
 

Detailed Description

Provides a wrapper around Mutex that automatically acquires on creating and releases on Dispose.

Instead of lock (_object) { code(); } for per-process locking use using (new MutexLock("name") { code(); } for inter-process locking.

Automatically handles AbandonedMutexException with Log.Warn(Exception).

Constructor & Destructor Documentation

◆ MutexLock()

NanoByte.Common.MutexLock.MutexLock ( string  name)
inline

Acquires Mutex with name .

Member Function Documentation

◆ Dispose()

void NanoByte.Common.MutexLock.Dispose ( )
inline

Releases the Mutex.


The documentation for this class was generated from the following file: