Class Synchronizer
Provides a framework for implementing asynchronous locks and related synchronization primitives that doesn't rely on first-in-first-out (FIFO) wait queues.
Implements
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public abstract class Synchronizer : Disposable, ISynchronizer
Remarks
Derived synchronization primitives more efficient in terms of memory pressure in comparison with QueuedSynchronizer.
It shares the same instance of
Properties
| Improve this Doc View SourceIsSet
Determines whether this event in signaled state.
Declaration
public bool IsSet { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceDispose(Boolean)
Releases all resources associated with exclusive lock.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | Indicates whether the Dispose(Boolean) has been called directly or from finalizer. |
Remarks
This method is not thread-safe and may not be used concurrently with other members of this instance.
Wait(TimeSpan, CancellationToken)
Suspends the caller until this event is set.
Declaration
public Task<bool> Wait(TimeSpan timeout, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The number of time to wait before this event is set. |
CancellationToken | token | The token that can be used to cancel waiting operation. |
Returns
Type | Description |
---|---|
Task<Boolean> | true, if this event was set; otherwise, false. |
Explicit Interface Implementations
| Improve this Doc View SourceISynchronizer.HasWaiters
Declaration
bool ISynchronizer.HasWaiters { get; }
Returns
Type | Description |
---|---|
Boolean |