SpicyPixel.Threading.UnityFiberScheduler Class Reference

FiberScheduler that can execute fibers (yieldable coroutines) during the update cycle of a MonoBehaviour. More...

+ Inheritance diagram for SpicyPixel.Threading.UnityFiberScheduler:
+ Collaboration diagram for SpicyPixel.Threading.UnityFiberScheduler:

Public Member Functions

 UnityFiberScheduler (MonoBehaviour behaviour)
 Initializes a new instance of the SpicyPixel.Threading.UnityFiberScheduler class. More...
 
override string ToString ()
 Returns a System.String that represents the current SpicyPixel.Threading.UnityFiberScheduler. More...
 
- Public Member Functions inherited from SpicyPixel.Threading.FiberScheduler
void Run (Fiber fiber)
 Run the blocking scheduler loop and perform the specified number of updates per second. More...
 
virtual void Run (Fiber fiber, CancellationToken token, float updatesPerSecond=0f)
 Run the blocking scheduler loop and perform the specified number of updates per second. More...
 
void Run ()
 Run the blocking scheduler loop and perform the specified number of updates per second. More...
 
virtual void Run (CancellationToken token, float updatesPerSecond=0f)
 Run the blocking scheduler loop and perform the specified number of updates per second. More...
 
void Dispose ()
 Releases all resource used by the SpicyPixel.Threading.FiberScheduler object. More...
 

Protected Member Functions

override void QueueFiber (Fiber fiber)
 Queues the fiber for execution on the scheduler. More...
 
override void AbortRequested (Fiber fiber)
 Invoked when an abort has been requested. More...
 
override void Dispose (bool disposing)
 Dispose the scheduler. More...
 
- Protected Member Functions inherited from SpicyPixel.Threading.FiberScheduler
 FiberScheduler ()
 Initializes a new instance of the SpicyPixel.Threading.FiberScheduler class. More...
 
FiberInstruction ExecuteFiber (Fiber fiber)
 Executes the fiber until it ends or yields. More...
 

Properties

static UnityFiberScheduler Default [get]
 Gets the shared fiber scheduler instance. More...
 
- Properties inherited from SpicyPixel.Threading.FiberScheduler
CancellationToken CancellationToken [get]
 Gets the cancellation token set when the scheduler is destroyed. More...
 
static FiberScheduler Current [get]
 Gets the default fiber scheduler for the thread. More...
 
Thread SchedulerThread [get]
 Gets the thread the scheduler is running on. More...
 
bool AllowInlining [get, set]
 Gets or sets a value indicating whether this SpicyPixel.Threading.FiberScheduler allows inlining. More...
 

Detailed Description

FiberScheduler that can execute fibers (yieldable coroutines) during the update cycle of a MonoBehaviour.

Definition at line 40 of file UnityFiberScheduler.cs.

Constructor & Destructor Documentation

SpicyPixel.Threading.UnityFiberScheduler.UnityFiberScheduler ( MonoBehaviour  behaviour)

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

Parameters
behaviourThe behaviour to use for scheduling with Unity.

Definition at line 78 of file UnityFiberScheduler.cs.

Member Function Documentation

override void SpicyPixel.Threading.UnityFiberScheduler.AbortRequested ( Fiber  fiber)
protectedvirtual

Invoked when an abort has been requested.

Unity is always running scheduled fibers and so there is nothing special to do here to get it to attempt to execute the fiber again (which will trigger the abort).

Parameters
fiberThe fiber to be aborted.

Implements SpicyPixel.Threading.FiberScheduler.

Definition at line 120 of file UnityFiberScheduler.cs.

override void SpicyPixel.Threading.UnityFiberScheduler.Dispose ( bool  disposing)
protectedvirtual

Dispose the scheduler.

Parameters
disposingDisposing.

Reimplemented from SpicyPixel.Threading.FiberScheduler.

Definition at line 256 of file UnityFiberScheduler.cs.

override void SpicyPixel.Threading.UnityFiberScheduler.QueueFiber ( Fiber  fiber)
protectedvirtual

Queues the fiber for execution on the scheduler.

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

Parameters
fiberThe fiber to queue.

Implements SpicyPixel.Threading.FiberScheduler.

Definition at line 94 of file UnityFiberScheduler.cs.

override string SpicyPixel.Threading.UnityFiberScheduler.ToString ( )

Returns a System.String that represents the current SpicyPixel.Threading.UnityFiberScheduler.

Returns
A System.String that represents the current SpicyPixel.Threading.UnityFiberScheduler.

Definition at line 240 of file UnityFiberScheduler.cs.

Property Documentation

UnityFiberScheduler SpicyPixel.Threading.UnityFiberScheduler.Default
staticget

Gets the shared fiber scheduler instance.

The shared fiber scheduler instance bound to the shared SpicyPixel.Threading.ConcurrentBehaviour .

Definition at line 50 of file UnityFiberScheduler.cs.


The documentation for this class was generated from the following file: