C# 클래스 Examples.PeriodicTaskFactory

Factory class to create a periodic Task to simulate a System.Threading.Timer using Tasks.
파일 보기 프로젝트 열기: pushtechnology/diffusion-examples 1 사용 예제들

공개 메소드들

메소드 설명
Start ( System.Action action, int intervalInMilliseconds = Timeout.Infinite, int delayInMilliseconds, int duration = Timeout.Infinite, int maxIterations = -1, bool synchronous = false, CancellationToken cancelToken = newCancellationToken(), TaskCreationOptions periodicTaskCreationOptions = TaskCreationOptions.None ) : Task

Starts the periodic task.

Exceptions that occur in the action need to be handled in the action itself. These exceptions will not be bubbled up to the periodic task.

비공개 메소드들

메소드 설명
CheckIfCancelled ( CancellationToken cancellationToken ) : void

Checks if cancelled.

MainPeriodicTaskAction ( int intervalInMilliseconds, int delayInMilliseconds, int duration, int maxIterations, CancellationToken cancelToken, Stopwatch stopWatch, bool synchronous, System.Action wrapperAction, TaskCreationOptions periodicTaskCreationOptions ) : void

Mains the periodic task action.

메소드 상세

Start() 공개 정적인 메소드

Starts the periodic task.
Exceptions that occur in the action need to be handled in the action itself. These exceptions will not be bubbled up to the periodic task.
public static Start ( System.Action action, int intervalInMilliseconds = Timeout.Infinite, int delayInMilliseconds, int duration = Timeout.Infinite, int maxIterations = -1, bool synchronous = false, CancellationToken cancelToken = newCancellationToken(), TaskCreationOptions periodicTaskCreationOptions = TaskCreationOptions.None ) : Task
action System.Action The action.
intervalInMilliseconds int The interval in milliseconds.
delayInMilliseconds int The delay in milliseconds, i.e. how long it waits to kick off the timer.
duration int /// The duration. /// If the duration is set to 10 seconds, the maximum time this task is allowed to run is 10 seconds. ///
maxIterations int The max iterations.
synchronous bool /// if set to true executes each period in a blocking fashion and each periodic execution of the task /// is included in the total duration of the Task. ///
cancelToken System.Threading.CancellationToken The cancel token.
periodicTaskCreationOptions TaskCreationOptions /// used to create the task for executing the /// . ///
리턴 Task