C# 클래스 HikariThreading.Hikari

Never put Hikari on a GameObject! Hikari will spawn one for you. Hikari is the entry point to the threading system. It is fully threadsafe and designed to be accessed statically. To schedule a task in Hikari use the following code: Hikari.Schedule( ( ActionTask task ) => YourWorkHere(); ) To schedule a task in Unity use the following code: Hikari.ScheduleUnity( ( ActionTask task ) => YourWorkHere(); ) You may also schedule tasks using enumerators, similar to coroutines in Unity.
상속: UnityEngine.MonoBehaviour
파일 보기 프로젝트 열기: ReinAkane/Hikari 1 사용 예제들

Private Properties

프로퍼티 타입 설명
RequeueTask void
Start void
StartSpawn UnityEngine.GameObject
Update void

공개 메소드들

메소드 설명
Schedule ( Action to_schedule, bool cancel_extensions_on_abort = true ) : ActionTask

Schedules a task to be run in Hikari.

Schedule ( System to_schedule, bool cancel_extensions_on_abort = true ) : EnumeratorTask

Schedules a task to be run in Hikari. Enumerator tasks may yield null to allow napping, or yield another Task to nap until that task finishes, then start up again.

ScheduleUnity ( Action to_schedule, bool cancel_extensions_on_abort = true ) : ActionTask

Schedules a task to be run on Unity's thread.

ScheduleUnity ( System to_schedule, bool cancel_extensions_on_abort = true ) : EnumeratorTask

Schedules a task to be run on Unity's thread. Enumerator tasks may yield null to allow napping, or yield another Task to nap until that task finishes, then start up again.

Spawn ( ) : UnityEngine.GameObject

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.

Spawn ( int max_tasks_per_frame ) : UnityEngine.GameObject

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.

Spawn ( int min_threads, int max_threads ) : UnityEngine.GameObject

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.

Spawn ( int max_tasks_per_frame, int min_threads, int max_threads ) : UnityEngine.GameObject

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.

Spawn ( int max_tasks_per_frame, 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 ) : UnityEngine.GameObject

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.

Spawn ( ) : void
SpawnDedicatedTask ( Action task, bool cancel_extensions_on_abort = true ) : ActionTask

Creates a dedicated task and a thread for it. Dedicated tasks will not relinquish control of their thread while napping, allowing them to restart immediately after napping. Once the task has completed, its thread will be recycled in Hikari and may be used for other tasks.

SpawnDedicatedTask ( System task, bool cancel_extensions_on_abort = true ) : EnumeratorTask

Creates a dedicated task and a thread for it. Dedicated tasks will not relinquish control of their thread while napping, allowing them to restart immediately after napping. Once the task has completed, its thread will be recycled in Hikari and may be used for other tasks. Enumerator tasks may yield null to allow napping, or yield another Task to nap until that task finishes, then start up again.

비공개 메소드들

메소드 설명
RequeueTask ( ITask task ) : void

Re-enters the passed Task into the Thread- or UnityManager (based on which it started in). This should only be called when the Task is already completed.

Start ( ) : void

Failsafe so that no one accidentally creates a Hikari object.

StartSpawn ( ) : UnityEngine.GameObject

This does the reusable parts of the overloaded Spawn() method.

Update ( ) : void

Unity's update loop. All we need to do is update the managers.

메소드 상세

Schedule() 공개 정적인 메소드

Schedules a task to be run in Hikari.
public static Schedule ( Action to_schedule, bool cancel_extensions_on_abort = true ) : ActionTask
to_schedule Action The method to run in the task.
cancel_extensions_on_abort bool Whether or not to cancel extensions automatically when the Task is aborted. Defaults to true.
리턴 ActionTask

Schedule() 공개 정적인 메소드

Schedules a task to be run in Hikari. Enumerator tasks may yield null to allow napping, or yield another Task to nap until that task finishes, then start up again.
public static Schedule ( System to_schedule, bool cancel_extensions_on_abort = true ) : EnumeratorTask
to_schedule System The enumerator to run in the task.
cancel_extensions_on_abort bool Whether or not to cancel extensions automatically when the Task is aborted. Defaults to true.
리턴 EnumeratorTask

ScheduleUnity() 공개 정적인 메소드

Schedules a task to be run on Unity's thread.
public static ScheduleUnity ( Action to_schedule, bool cancel_extensions_on_abort = true ) : ActionTask
to_schedule Action The method to run in the task.
cancel_extensions_on_abort bool Whether or not to cancel extensions automatically when the Task is aborted. Defaults to true.
리턴 ActionTask

ScheduleUnity() 공개 정적인 메소드

Schedules a task to be run on Unity's thread. Enumerator tasks may yield null to allow napping, or yield another Task to nap until that task finishes, then start up again.
public static ScheduleUnity ( System to_schedule, bool cancel_extensions_on_abort = true ) : EnumeratorTask
to_schedule System The enumerator to run in the task.
cancel_extensions_on_abort bool Whether or not to cancel extensions automatically when the Task is aborted. Defaults to true.
리턴 EnumeratorTask

Spawn() 공개 정적인 메소드

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.
public static Spawn ( ) : UnityEngine.GameObject
리턴 UnityEngine.GameObject

Spawn() 공개 정적인 메소드

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.
public static Spawn ( int max_tasks_per_frame ) : UnityEngine.GameObject
max_tasks_per_frame int The maximum number of Tasks for Hikari to run in Unity per frame.
리턴 UnityEngine.GameObject

Spawn() 공개 정적인 메소드

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.
public static Spawn ( int min_threads, int max_threads ) : UnityEngine.GameObject
min_threads int The minimum number of Threads for Hikari to have spawned at once.
max_threads int The maximum number of Threads for Hikari to have spawned at once. Dedicated Tasks may cause Hikari to go over this maximum.
리턴 UnityEngine.GameObject

Spawn() 공개 정적인 메소드

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.
public static Spawn ( int max_tasks_per_frame, int min_threads, int max_threads ) : UnityEngine.GameObject
max_tasks_per_frame int The maximum number of Tasks for Hikari to run in Unity per frame.
min_threads int The minimum number of Threads for Hikari to have spawned at once.
max_threads int The maximum number of Threads for Hikari to have spawned at once. Dedicated Tasks may cause Hikari to go over this maximum.
리턴 UnityEngine.GameObject

Spawn() 공개 정적인 메소드

Starts up Hikari with all the default options. Not necessary to call, but if you don't a GameObject will be spawned the first time you call Hikari. The spawned GameObject will be set to not destroy on load. Spawn is not threadsafe.
public static Spawn ( int max_tasks_per_frame, 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 ) : UnityEngine.GameObject
max_tasks_per_frame int The maximum number of Tasks for Hikari to run in Unity per frame.
min_threads int The minimum number of Threads for Hikari to have spawned at once.
max_threads int The maximum number of Threads for Hikari to have spawned at once. Dedicated Tasks may cause Hikari to go over this maximum.
min_ms_between_thread_spawn System.TimeSpan The minimum amount of time to wait before spawning a new thread.
max_ms_task_waiting_before_thread_spawn System.TimeSpan The maximum time that a Task can be waiting in the queue before we spawn a new thread.
max_queue_length_before_thread_spawn uint The maximum number of Tasks waiting in queue before we spawn a new thread.
max_boredom_time_before_thread_despawn System.TimeSpan The maximum amount of time a thread can be idle before despawning the thread.
리턴 UnityEngine.GameObject

Spawn() 공개 정적인 메소드

public static Spawn ( ) : void
리턴 void

SpawnDedicatedTask() 공개 정적인 메소드

Creates a dedicated task and a thread for it. Dedicated tasks will not relinquish control of their thread while napping, allowing them to restart immediately after napping. Once the task has completed, its thread will be recycled in Hikari and may be used for other tasks.
public static SpawnDedicatedTask ( Action task, bool cancel_extensions_on_abort = true ) : ActionTask
task Action The action to run on the new dedicated task.
cancel_extensions_on_abort bool Whether or not to cancel extensions automatically when the Task is aborted. Defaults to true.
리턴 ActionTask

SpawnDedicatedTask() 공개 정적인 메소드

Creates a dedicated task and a thread for it. Dedicated tasks will not relinquish control of their thread while napping, allowing them to restart immediately after napping. Once the task has completed, its thread will be recycled in Hikari and may be used for other tasks. Enumerator tasks may yield null to allow napping, or yield another Task to nap until that task finishes, then start up again.
public static SpawnDedicatedTask ( System task, bool cancel_extensions_on_abort = true ) : EnumeratorTask
task System The enumerator to run on the new dedicated task.
cancel_extensions_on_abort bool Whether or not to cancel extensions automatically when the Task is aborted. Defaults to true.
리턴 EnumeratorTask