Header menu logo TDesu.FSharp

PeriodicTimer Module

Periodic background timer — runs an action at fixed intervals with cancellation.

Functions and values

Function or value Description

PeriodicTimer.start interval action ct onError

Full Usage: PeriodicTimer.start interval action ct onError

Parameters:
Returns: Task

Starts a background loop that runs action every interval. The delay between each tick. The async action to execute on each tick. The cancellation token to stop the loop. Handler invoked when the action throws a non-cancellation exception.

interval : TimeSpan
action : unit -> Task<unit>
ct : CancellationToken
onError : exn -> unit
Returns: Task

PeriodicTimer.startCounted interval action ct onError

Full Usage: PeriodicTimer.startCounted interval action ct onError

Parameters:
Returns: Task

Like start, but action receives a counter (0-based) for each tick. The delay between each tick. The async action to execute, receiving the current tick index. The cancellation token to stop the loop. Handler invoked when the action throws a non-cancellation exception.

interval : TimeSpan
action : int -> Task<unit>
ct : CancellationToken
onError : exn -> unit
Returns: Task

Type something to start searching.