Table of Contents

Method RegisterAsyncTimer

Namespace
KZDev.SystemClock.PrimeTime
Assembly
KZDev.SystemClock.PrimeTime.dll

RegisterAsyncTimer(TimeSpan, TimeSpan, Func<ClockTimerCallbackContext, CancellationToken, ValueTask>, CancellationToken, object?, IntervalTimerOptions?)

Registers an interval timer with an initial delay, a repeat interval, and an asynchronous callback that receives timer context and cancellation token. Other RegisterAsyncTimer overloads are provided as extension methods.

IClockIntervalTimer RegisterAsyncTimer(TimeSpan callbackTime, TimeSpan repeatInterval, Func<ClockTimerCallbackContext, CancellationToken, ValueTask> callback, CancellationToken cancellationToken, object? state = null, IntervalTimerOptions? timerOptions = null)

Parameters

callbackTime TimeSpan

Time until the first callback.

repeatInterval TimeSpan

Interval for subsequent callbacks; InfiniteTimeSpan for one-shot.

callback Func<ClockTimerCallbackContext, CancellationToken, ValueTask>

The async callback; receives timer context and a cancellation token.

cancellationToken CancellationToken

Token that participates in cancelling the timer registration and is passed to the callback; use None when no external cancellation is required.

state object

Optional state passed to the callback via ClockTimerCallbackContext.

timerOptions IntervalTimerOptions

Optional timer options.

Returns

IClockIntervalTimer

An IClockIntervalTimer to monitor or change the timer.