CoalescingSignal
Ecng.Common
A wake-up for work that has to happen when something changes, rather than on a clock.
Implementa: IDisposable
Constructores
CoalescingSignal
public CoalescingSignal(TimeSpan window)
coalescingSignal = CoalescingSignal(window)
Initializes a new instance of the CoalescingSignal.
- window
- How long a raise is held before the wait completes, so everything changed within it is taken in one round. Zero wakes the reader as soon as it is raised.
Propiedades
Window
public TimeSpan Window { get; }
value = coalescingSignal.Window
How long a raise is held before the wait completes.
Métodos
Dispose
public void Dispose()
coalescingSignal.Dispose()
Disposes of items in the pool that implement IDisposable.
Raise
public void Raise()
coalescingSignal.Raise()
Notes that something changed and wakes whoever is waiting. Never blocks and never throws, including after Dispose: this runs on paths that see every message, and a change noted during shutdown is not a fault.
WaitAsync
public Task WaitAsync(CancellationToken cancellationToken)
result = coalescingSignal.WaitAsync(cancellationToken)
Completes one window after the next raise, or one window from now if a raise is already pending.
- cancellationToken
- Cancellation token.
Devuelve: A task that completes once there is something to do.