C# 클래스 Recognos.Core.TaskExecutor

Helper class to run a set of tasks in parallel. This class uses a number of worker threads witch will execute the queued tasks in parallel as much as possible. The worker threads are background threads and you must call Dispose() or Finish() to ensure all the tasks are finished
상속: IDisposable
파일 보기 프로젝트 열기: Recognos/Recognos.Core 1 사용 예제들

공개 메소드들

메소드 설명
AddTask ( System.Action task ) : void

Add a task to the queue

Dispose ( ) : void

Ensure the wait handles are closed

Finish ( ) : void

Wait for the tasks to finish executing.

After calling finish, you can't add any more tasks to this runner.

FlushTasks ( ) : void

Wait for all currenty added tasks to finish executing and continue waiting for tasks

TaskExecutor ( ) : System

Initializes a new instance of the TaskExecutor class. The WorkerCount is set to the Number of cores

TaskExecutor ( int workerCount ) : System

Initializes a new instance of the TaskExecutor class.

TaskExecutor ( int workerCount, bool highPriority, string name ) : System

Initializes a new instance of the TaskExecutor class.

비공개 메소드들

메소드 설명
RunPendingTasks ( ) : void

Run tasks in the queue

RunTask ( System.Action task ) : void
RunWorker ( ) : void

Start running the tasks

메소드 상세

AddTask() 공개 메소드

Add a task to the queue
public AddTask ( System.Action task ) : void
task System.Action Task to add
리턴 void

Dispose() 공개 메소드

Ensure the wait handles are closed
public Dispose ( ) : void
리턴 void

Finish() 공개 메소드

Wait for the tasks to finish executing.
After calling finish, you can't add any more tasks to this runner.
public Finish ( ) : void
리턴 void

FlushTasks() 공개 메소드

Wait for all currenty added tasks to finish executing and continue waiting for tasks
public FlushTasks ( ) : void
리턴 void

TaskExecutor() 공개 메소드

Initializes a new instance of the TaskExecutor class. The WorkerCount is set to the Number of cores
public TaskExecutor ( ) : System
리턴 System

TaskExecutor() 공개 메소드

Initializes a new instance of the TaskExecutor class.
public TaskExecutor ( int workerCount ) : System
workerCount int Number of workers to use
리턴 System

TaskExecutor() 공개 메소드

Initializes a new instance of the TaskExecutor class.
public TaskExecutor ( int workerCount, bool highPriority, string name ) : System
workerCount int Worker count
highPriority bool High priority workers
name string Name of this task runner ( used in thread names )
리턴 System