Method RegisterTimer
- Namespace
- KZDev.SystemClock.PrimeTime
- Assembly
- KZDev.SystemClock.PrimeTime.dll
RegisterTimer(TimeSpan, TimeSpan, Action<ClockTimerCallbackContext>, CancellationToken, object?, IntervalTimerOptions?)
Registers an interval timer with an initial delay, a repeat interval, and a synchronous callback that receives
timer context. Other RegisterTimer overloads are provided as extension methods.
IClockIntervalTimer RegisterTimer(TimeSpan callbackTime, TimeSpan repeatInterval, Action<ClockTimerCallbackContext> callback, CancellationToken cancellationToken, object? state = null, IntervalTimerOptions? timerOptions = null)
Parameters
callbackTimeTimeSpanTime until the first callback.
repeatIntervalTimeSpanInterval for subsequent callbacks; InfiniteTimeSpan for one-shot.
callbackAction<ClockTimerCallbackContext>The callback invoked when the timer fires; receives timer context.
cancellationTokenCancellationTokenToken that participates in cancelling the timer registration; pass None when no external cancellation is required.
stateobjectOptional state passed to the callback via ClockTimerCallbackContext.
timerOptionsIntervalTimerOptionsOptional timer options.
Returns
- IClockIntervalTimer
An IClockIntervalTimer to monitor or change the timer.