Edit

Share via


SystemTarget.RegisterTimer Method

Definition

Registers a timer to send regular callbacks to this grain. This timer will keep the current grain from being deactivated.

public IDisposable RegisterTimer (Func<object,System.Threading.Tasks.Task> asyncCallback, object state, TimeSpan dueTime, TimeSpan period, string name = default);
member this.RegisterTimer : Func<obj, System.Threading.Tasks.Task> * obj * TimeSpan * TimeSpan * string -> IDisposable
Public Function RegisterTimer (asyncCallback As Func(Of Object, Task), state As Object, dueTime As TimeSpan, period As TimeSpan, Optional name As String = Nothing) As IDisposable

Parameters

asyncCallback
Func<Object,Task>

The timer callback, which will fire whenever the timer becomes due.

state
Object

The state object passed to the callback.

dueTime
TimeSpan

The amount of time to delay before the asyncCallback is invoked. Specify InfiniteTimeSpan to prevent the timer from starting. Specify Zero to invoke the callback promptly.

period
TimeSpan

The time interval between invocations of asyncCallback. Specify InfiniteTimeSpan to disable periodic signalling.

name
String

The timer name.

Returns

An IDisposable object which will cancel the timer upon disposal.

Applies to