Thetype exposes the following members.
Returns the cancellation token.
Returns the task interval.
Stops the task if it's running.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Serves as the default hash function.(Inherited from Object.)
Gets the Type of the current instance.(Inherited from Object.)
Asynchronously executes the task until it exits or is canceled.
Returns a string that represents the current object.(Inherited from Object.)
This class provides a nice way to implement the very common server side pattern where we need to periodically perform some operation until the operation signals that it's done or the task is canceled, while handling some of the messy exception handling details.
You'll use the AsyncPeriodicTask(TimeSpan, FuncTaskBoolean, FuncException, TaskBoolean, FuncTask, CancellationTokenSource) constructor to create a task, passing the task interval, asynchronous task handler and optional exception handler and cancellation token and then call Run to execute the task.
false to continue running or true to signal that should stop. also monitors the cancellation token passed and watches for OperationCanceledException thrown by the task handler to stop itself.will call the task handler, wait for the interval and then repeat. The task handler return
The exception handler will be called for all exceptions thrown by the task handler except for OperationCanceledException exceptions as these signal that should terminate. Exception handlers return false to continue running or true to signal that should stop. stop.
Finally, an optional handler can be specified that will be called just before theterminates.
|This class implements IDisposable and the task will be terminated when this is called.|