Class ClockedRunner
Utillity to invoke a delegate repeatingly with a given clock interval.
public sealed class ClockedRunner : IDisposable
- Inheritance
-
ClockedRunner
- Implements
- Inherited Members
- Extension Methods
Constructors
ClockedRunner(string, long, Func<CancellationToken, bool>, CancellationToken)
Ctor to start the clocked runner.
public ClockedRunner(string runnerTitle, long interval, Func<CancellationToken, bool> run, CancellationToken ctk = default)
Parameters
runnerTitle
stringDiagnostic title of the runner
interval
longclocked run inteval in msec.
run
Func<CancellationToken, bool>delegate to run, takes
ctk
and indicates with a return value == true to abort further clocked invocations.ctk
CancellationTokenCancellationToken to cancel the clocked runner
Remarks
The called run
delegate must return within interval
msec.
Failing to do so will result into a TimeoutException
Properties
ClockInterval
Clocked runner interval.
public long ClockInterval { get; }
Property Value
Title
Clocked runner title.
public string Title { get; }
Property Value
Methods
Dispose()
Stopps the clocked runner and release of all resources.
public void Dispose()