C# 클래스 SpicyPixel.Threading.Tasks.FiberTaskScheduler

TaskScheduler that can execute fibers (yieldable coroutines). Regular non-blocking tasks can also be scheduled on a FiberTaskScheduler, but YieldableTask have the distinct ability to yield execution.
상속: System.Threading.Tasks.TaskScheduler, IDisposable
파일 보기 프로젝트 열기: spicypixel/concurrency-kit-cs 1 사용 예제들

공개 메소드들

메소드 설명
Dispose ( ) : void

Releases all resource used by the SpicyPixel.Threading.Tasks.FiberTaskScheduler object.

Call the method when you are finished using the SpicyPixel.Threading.Tasks.FiberTaskScheduler. The method leaves the SpicyPixel.Threading.Tasks.FiberTaskScheduler in an unusable state. After calling the method, you must release all references to the SpicyPixel.Threading.Tasks.FiberTaskScheduler so the garbage collector can reclaim the memory that the SpicyPixel.Threading.Tasks.FiberTaskScheduler was occupying.

FiberTaskScheduler ( ) : System

Initializes a new instance of the SpicyPixel.Threading.Tasks.FiberTaskScheduler class.

Derived classes should invoke EnableQueueTask() in their constructor when ready to begin executing tasks.

FiberTaskScheduler ( FiberScheduler scheduler ) : System

Initializes a new instance of the SpicyPixel.Threading.Tasks.FiberTaskScheduler class.

Derived classes should invoke EnableQueueTask() in their constructor when ready to begin executing tasks.

보호된 메소드들

메소드 설명
GetScheduledTasks ( ) : IEnumerable

For debugger support only, generates an enumerable of Task instances currently queued to the scheduler waiting to be executed.

This is not supported and will always return null.

QueueTask ( Task task ) : void

Queues a non-blocking task.

If the task is queued from the scheduler thread it will begin executing to its first yield immediately.

TryDequeue ( Task task ) : bool

Tries to dequeue a task.

Only delay start tasks can be dequeued. Although the Fiber scheduler does delay start tasks queued from a non-scheduler thread, de-queuing is not supported right now and so this method always returns false.

TryExecuteTaskInline ( Task task, bool taskWasPreviouslyQueued ) : bool

Tries to execute the task inline.

Tasks executed on a fiber scheduler have thread affinity and must run on the thread the scheduler was created online. Inline execution will therefore fail if attempted from another thread besides the scheduler thread.

A YieldableTask cannot run inline because yieldable tasks can only be processed by a FiberTaskScheduler when queued.

Because of these restrictions, only standard non-blocking actions invoked on the scheduler thread are eligible for inlining.

비공개 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Dispose the scheduler.

When the scheduler is disposed, the CancellationToken is set.

ExecuteTask ( Task task ) : IEnumerator

Execute the specified task as a coroutine.

ExecuteYieldableTask ( YieldableTask task ) : IEnumerator

Execute the specified coroutine associated with a yieldable task.

Any exceptions that occur while executing the fiber will be associated with the specified task and rethrown by the framework.

메소드 상세

Dispose() 공개 메소드

Releases all resource used by the SpicyPixel.Threading.Tasks.FiberTaskScheduler object.
Call the method when you are finished using the SpicyPixel.Threading.Tasks.FiberTaskScheduler. The method leaves the SpicyPixel.Threading.Tasks.FiberTaskScheduler in an unusable state. After calling the method, you must release all references to the SpicyPixel.Threading.Tasks.FiberTaskScheduler so the garbage collector can reclaim the memory that the SpicyPixel.Threading.Tasks.FiberTaskScheduler was occupying.
public Dispose ( ) : void
리턴 void

FiberTaskScheduler() 공개 메소드

Initializes a new instance of the SpicyPixel.Threading.Tasks.FiberTaskScheduler class.
Derived classes should invoke EnableQueueTask() in their constructor when ready to begin executing tasks.
public FiberTaskScheduler ( ) : System
리턴 System

FiberTaskScheduler() 공개 메소드

Initializes a new instance of the SpicyPixel.Threading.Tasks.FiberTaskScheduler class.
Derived classes should invoke EnableQueueTask() in their constructor when ready to begin executing tasks.
public FiberTaskScheduler ( FiberScheduler scheduler ) : System
scheduler FiberScheduler
리턴 System

GetScheduledTasks() 보호된 메소드

For debugger support only, generates an enumerable of Task instances currently queued to the scheduler waiting to be executed.
This is not supported and will always return null.
protected GetScheduledTasks ( ) : IEnumerable
리턴 IEnumerable

QueueTask() 보호된 메소드

Queues a non-blocking task.
If the task is queued from the scheduler thread it will begin executing to its first yield immediately.
protected QueueTask ( Task task ) : void
task Task /// The non-blocking task to queue. ///
리턴 void

TryDequeue() 보호된 메소드

Tries to dequeue a task.
Only delay start tasks can be dequeued. Although the Fiber scheduler does delay start tasks queued from a non-scheduler thread, de-queuing is not supported right now and so this method always returns false.
protected TryDequeue ( Task task ) : bool
task Task /// The task to dequeue. ///
리턴 bool

TryExecuteTaskInline() 보호된 메소드

Tries to execute the task inline.

Tasks executed on a fiber scheduler have thread affinity and must run on the thread the scheduler was created online. Inline execution will therefore fail if attempted from another thread besides the scheduler thread.

A YieldableTask cannot run inline because yieldable tasks can only be processed by a FiberTaskScheduler when queued.

Because of these restrictions, only standard non-blocking actions invoked on the scheduler thread are eligible for inlining.

protected TryExecuteTaskInline ( Task task, bool taskWasPreviouslyQueued ) : bool
task Task /// The task to execute. ///
taskWasPreviouslyQueued bool /// Set to true if the task was previously queued, false otherwise. ///
리턴 bool