C# 클래스 HikariThreading.ThreadManager

Manages assignment of work for a pool of threads. All methods not marked unsafe are threadsafe. UnsafeUpdate must be called for ThreadManager to do any work, but ThreadManager will not call it.
상속: ManagerBase, IDisposable
파일 보기 프로젝트 열기: ReinAkane/Hikari 1 사용 예제들

Private Properties

프로퍼티 타입 설명
DespawnThread void
DespawnThreadIfNeeded bool
EnqueueTask void
HandleDedicatedThreads void
Initialize void
SpawnDedicatedThread void
SpawnThread void
SpawnThreadIfNeeded bool
ThreadManager System
ThreadManager System
ThreadManager System
ThreadManager System
UnsafeHandleThreads void
UnsafeUpdate void
WaitForThreadSpawns void

공개 메소드들

메소드 설명
Dispose ( ) : void

Tells all threads managed by this manager to stop running once their Tasks finish up.

비공개 메소드들

메소드 설명
DespawnThread ( ) : void

Despawns a thread.

DespawnThreadIfNeeded ( ) : bool

Checks if our situation calls for a thread to be despawned. If so, despawns one.

EnqueueTask ( ITask task ) : void

Enqueues a task to be run when the next thread is available.

HandleDedicatedThreads ( ) : void

Checks if any dedicated threads are finished, and if so adds them to the larger pool.

Initialize ( ) : void

Initializes the basic options for the ThreadManager.

SpawnDedicatedThread ( ITask task ) : void

Spawns a dedicated thread to run the passed task. Once the task is completed, the Thread will be recycled.

SpawnThread ( ) : void

Spawns a new thread and adds it to the thread pool.

SpawnThreadIfNeeded ( ) : bool

Checks if our situation calls for a new thread. If so, spawns one.

ThreadManager ( ) : System

Creates a ThreadManager with all the defaults.

ThreadManager ( System.TimeSpan min_ms_between_thread_spawn, System.TimeSpan max_ms_task_waiting_before_thread_spawn, uint max_queue_length_before_thread_spawn, System.TimeSpan max_boredom_time_before_thread_despawn ) : System

Creates a ThreadManager with customized logic on when to spawn and despawn threads.

ThreadManager ( int min_threads, int max_threads ) : System

Creates a very customized ThreadManager.

ThreadManager ( int min_threads, int max_threads, System.TimeSpan min_ms_between_thread_spawn, System.TimeSpan max_ms_task_waiting_before_thread_spawn, uint max_queue_length_before_thread_spawn, System.TimeSpan max_boredom_time_before_thread_despawn ) : System

Creates a very customized ThreadManager.

UnsafeHandleThreads ( ) : void

Assigns work and removed napping Task from their threads.

UnsafeUpdate ( ) : void

Checks for new work in the Queue and sends it out, checks for spawning and despawning threads.

WaitForThreadSpawns ( ) : void

Waits for all Threads to spawn. This is to make automated testing easier.

메소드 상세

Dispose() 공개 메소드

Tells all threads managed by this manager to stop running once their Tasks finish up.
public Dispose ( ) : void
리턴 void