C# Класс SpicyPixel.Threading.FiberScheduler

Schedules fibers for execution.
Schedulers are bound to the thread they are created on and they install a SynchronizationContext which is active during execution. Schedulers have an implementation specific update method or run loop. The interface is otherwise thin since schedulers are generally not intended to be used directly. Scheduling work is accomplished by invoking methods on Fiber or SynchronizationContext.
Наследование: IFiberScheduler, IDisposable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
IFiberScheduler void
SetCurrentScheduler void

Открытые методы

Метод Описание
Dispose ( ) : void

Releases all resource used by the SpicyPixel.Threading.FiberScheduler object.

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

Run ( ) : void

Run the blocking scheduler loop and perform the specified number of updates per second.

Not all schedulers support a blocking run loop that can be invoked by the caller.

Run ( CancellationToken token, float updatesPerSecond = 0f ) : void

Run the blocking scheduler loop and perform the specified number of updates per second.

Not all schedulers support a blocking run loop that can be invoked by the caller.

Run ( Fiber fiber ) : void

Run the blocking scheduler loop and perform the specified number of updates per second.

Not all schedulers support a blocking run loop that can be invoked by the caller.

Run ( Fiber fiber, CancellationToken token, float updatesPerSecond = 0f ) : void

Run the blocking scheduler loop and perform the specified number of updates per second.

Not all schedulers support a blocking run loop that can be invoked by the caller.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Dispose the scheduler.

When the scheduler is disposed, the CancellationToken is set.

ExecuteFiber ( Fiber fiber ) : FiberInstruction

Executes the fiber until it ends or yields.

Custom schedulers will need to invoke this method in order to actually perform the work of the fiber and cause the correct state transitions to occur.

FiberScheduler ( ) : System

Initializes a new instance of the SpicyPixel.Threading.FiberScheduler class.

QueueFiber ( Fiber fiber ) : void

Queues the fiber for execution on the scheduler.

Fibers queued from the scheduler thread will generally be executed inline whenever possible on most schedulers.

Приватные методы

Метод Описание
IFiberScheduler ( Fiber fiber ) : void
SetCurrentScheduler ( FiberScheduler scheduler, bool internalInvoke ) : void

Описание методов

Dispose() публичный Метод

Releases all resource used by the SpicyPixel.Threading.FiberScheduler object.
Call the method when you are finished using the SpicyPixel.Threading.FiberScheduler. The method leaves the SpicyPixel.Threading.FiberScheduler in an unusable state. After calling the method, you must release all references to the SpicyPixel.Threading.FiberScheduler so the garbage collector can reclaim the memory that the SpicyPixel.Threading.FiberScheduler was occupying.
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

Dispose the scheduler.
When the scheduler is disposed, the CancellationToken is set.
protected Dispose ( bool disposing ) : void
disposing bool /// Disposing is true when called manually, /// false when called by the finalizer. ///
Результат void

ExecuteFiber() защищенный Метод

Executes the fiber until it ends or yields.
Custom schedulers will need to invoke this method in order to actually perform the work of the fiber and cause the correct state transitions to occur.
protected ExecuteFiber ( Fiber fiber ) : FiberInstruction
fiber Fiber /// The fiber to execute. ///
Результат FiberInstruction

FiberScheduler() защищенный Метод

Initializes a new instance of the SpicyPixel.Threading.FiberScheduler class.
protected FiberScheduler ( ) : System
Результат System

QueueFiber() защищенный абстрактный Метод

Queues the fiber for execution on the scheduler.
Fibers queued from the scheduler thread will generally be executed inline whenever possible on most schedulers.
protected abstract QueueFiber ( Fiber fiber ) : void
fiber Fiber /// The fiber to queue. ///
Результат void

Run() публичный Метод

Run the blocking scheduler loop and perform the specified number of updates per second.
Not all schedulers support a blocking run loop that can be invoked by the caller.
public Run ( ) : void
Результат void

Run() публичный Метод

Run the blocking scheduler loop and perform the specified number of updates per second.
Not all schedulers support a blocking run loop that can be invoked by the caller.
public Run ( CancellationToken token, float updatesPerSecond = 0f ) : void
token System.Threading.CancellationToken /// A cancellation token that can be used to stop execution. ///
updatesPerSecond float /// Updates to all fibers per second. A value of 0 (the default) will execute fibers /// any time they are ready to do work instead of waiting to execute on a specific frequency. ///
Результат void

Run() публичный Метод

Run the blocking scheduler loop and perform the specified number of updates per second.
Not all schedulers support a blocking run loop that can be invoked by the caller.
public Run ( Fiber fiber ) : void
fiber Fiber /// The initial fiber to start on the scheduler. ///
Результат void

Run() публичный Метод

Run the blocking scheduler loop and perform the specified number of updates per second.
Not all schedulers support a blocking run loop that can be invoked by the caller.
public Run ( Fiber fiber, CancellationToken token, float updatesPerSecond = 0f ) : void
fiber Fiber /// The optional fiber to start execution from. If this is null, the loop /// will continue to execute until cancelled. Otherwise, the loop will terminate /// when the fiber terminates. ///
token System.Threading.CancellationToken /// A cancellation token that can be used to stop execution. ///
updatesPerSecond float /// Updates to all fibers per second. A value of 0 (the default) will execute fibers /// any time they are ready to do work instead of waiting to execute on a specific frequency. ///
Результат void