Table of Contents

Class MutexLock

Namespace
NanoByte.Common.Threading
Assembly
NanoByte.Common.dll

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

[MustDisposeResource]
public sealed class MutexLock
Inheritance
MutexLock
Extension Methods

Examples

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

Remarks

Constructors

MutexLock(string)

Acquires Mutex with name.

public MutexLock(string name)

Parameters

name string

Methods

Dispose()

Releases the Mutex.

public void Dispose()