Struct ReadGuard
Represents a disposable read guard over a ReadWriteLock.
Implements
Namespace: Singulink.Threading
Assembly: Singulink.Threading.dll
Syntax
public struct ReadGuard : IDisposable
Remarks
Guards returned from TryEnter methods may not have entered the lock, so check
IsEntered after acquiring. Disposing a guard that did not enter the lock is a safe no-op,
so guards can always be assigned directly to a using declaration.
Guards are thread-affine: an entered guard must be disposed on the thread that entered the lock, which is enforced with an InvalidOperationException when violated.
Properties
| Name | Description |
|---|---|
| IsDefault | Gets a value indicating whether the instance is in its default, uninitialized state. |
| IsDisposed | Gets a value indicating whether the object has been disposed. |
| IsEntered | Gets a value indicating whether the guard entered the lock. Always true for guards
obtained from EnterReadGuard(); guards obtained from |
Methods
| Name | Description |
|---|---|
| Dispose() | Releases the read guard. No-op if the guard did not enter the lock. |