Class to use the using() {} pattern to take care of locking / unlocking one of:
More...
|
| AutoLocker (Semaphore semaphore) |
| Constructs a new AutoLocker, immediately locking the provided Semaphore.
|
| AutoLocker (Semaphore semaphore, Action onDisposed) |
| Constructs a new AutoLocker, immediately locking the provided Semaphore, with an OnDisposed event handler.
|
| AutoLocker (SemaphoreSlim semaphore) |
| Constructs a new AutoLocker, immediately locking the provided SemaphoreSlim.
|
| AutoLocker (SemaphoreSlim semaphore, Action onDisposed) |
| Constructs a new AutoLocker, immediately locking the provided SemaphoreSlim, with an OnDisposed event handler.
|
| AutoLocker (Mutex mutex) |
| Constructs a new AutoLocker, immediately locking the provided Mutex.
|
| AutoLocker (Mutex mutex, Action onDisposed) |
| Constructs a new AutoLocker, immediately locking the provided Mutex, with an OnDisposed event handler.
|
void | Dispose () |
|
EventHandler | OnDisposed [get, set] |
| Subscribe to this to be notified when this locker is disposed, or pass an action in on the constructor.
|
Class to use the using() {} pattern to take care of locking / unlocking one of:
- Semaphore
- SemaphoreSlim
- Mutex without the consumer having to worry about unlocking in the event of exception handling
◆ AutoLocker() [1/6]
PeanutButter.Utils.AutoLocker.AutoLocker |
( |
Semaphore | semaphore | ) |
|
Constructs a new AutoLocker, immediately locking the provided Semaphore.
- Parameters
-
semaphore | Semaphore to lock immediately |
- Exceptions
-
ArgumentNullException | Throws ArgumentNullException if the provided Semaphore is null |
◆ AutoLocker() [2/6]
PeanutButter.Utils.AutoLocker.AutoLocker |
( |
Semaphore | semaphore, |
|
|
Action | onDisposed ) |
Constructs a new AutoLocker, immediately locking the provided Semaphore, with an OnDisposed event handler.
- Parameters
-
- Exceptions
-
◆ AutoLocker() [3/6]
PeanutButter.Utils.AutoLocker.AutoLocker |
( |
SemaphoreSlim | semaphore | ) |
|
Constructs a new AutoLocker, immediately locking the provided SemaphoreSlim.
- Parameters
-
semaphore | SemaphoreSlim to lock immediately |
- Exceptions
-
ArgumentNullException | Thrown if the provided SemaphoreSlim is null |
◆ AutoLocker() [4/6]
PeanutButter.Utils.AutoLocker.AutoLocker |
( |
SemaphoreSlim | semaphore, |
|
|
Action | onDisposed ) |
Constructs a new AutoLocker, immediately locking the provided SemaphoreSlim, with an OnDisposed event handler.
- Parameters
-
- Exceptions
-
◆ AutoLocker() [5/6]
PeanutButter.Utils.AutoLocker.AutoLocker |
( |
Mutex | mutex | ) |
|
Constructs a new AutoLocker, immediately locking the provided Mutex.
- Parameters
-
mutex | Mutex to lock immediately |
- Exceptions
-
ArgumentNullException | Thrown if the provided Mutex is null |
◆ AutoLocker() [6/6]
PeanutButter.Utils.AutoLocker.AutoLocker |
( |
Mutex | mutex, |
|
|
Action | onDisposed ) |
Constructs a new AutoLocker, immediately locking the provided Mutex, with an OnDisposed event handler.
- Parameters
-
mutex | Mutex to lock immediately |
onDisposed | |
- Exceptions
-
ArgumentNullException | Thrown if the provided Mutex is null |
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/AutoLocker.cs