Fiber.cs
Go to the documentation of this file.
418 public Fiber(Func<object, FiberInstruction> func, object state) : this(func, state, CancellationToken.None)
432 public Fiber(Func<object, FiberInstruction> func, object state, CancellationToken cancellationToken)
464 var originalState = (FiberStatus)Interlocked.CompareExchange(ref status, (int)FiberStatus.WaitingToRun, (int)FiberStatus.Created);
466 originalState = (FiberStatus)Interlocked.CompareExchange(ref status, (int)FiberStatus.WaitingToRun, (int)FiberStatus.WaitingForActivation);
468 throw new InvalidOperationException("A fiber cannot be started again once it has begun running or has completed.");
488 throw new InvalidOperationException("An attempt was made to execute a completed Fiber. This indicates a logic error in the scheduler.");
626 if (instruction is YieldUntilComplete && ((YieldUntilComplete)instruction).Fiber.Scheduler != FiberScheduler.Current)
627 throw new InvalidOperationException("Currently only fibers belonging to the same scheduler may be yielded to. FiberScheduler.Current = "
629 + ", Fiber.Scheduler = " + (((YieldUntilComplete)instruction).Fiber.Scheduler == null ? "null" : ((YieldUntilComplete)instruction).Fiber.Scheduler.ToString()));
634 Interlocked.CompareExchange(ref yieldToFiberInstruction.Fiber.status, (int)FiberStatus.WaitingToRun, (int)FiberStatus.Created);
635 var originalState = (FiberStatus)Interlocked.CompareExchange(ref yieldToFiberInstruction.Fiber.status, (int)FiberStatus.Running, (int)FiberStatus.WaitingToRun);
645 throw new InvalidOperationException("Currently only fibers belonging to the same scheduler may be yielded to. FiberScheduler.Current = "
647 + ", Fiber.Scheduler = " + (yieldToFiberInstruction.Fiber.Scheduler == null ? "null" : yieldToFiberInstruction.Fiber.Scheduler.ToString()));
Fiber(Action< object > action, object state, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:377
Yield execution until the watched fiber on the same scheduler is complete.
Definition: YieldUntilComplete.cs:36
Fiber(Action< object > action, object state)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:363
Wraps an object as an instruction
Definition: ObjectInstruction.cs:34
Definition: AggregateException.cs:31
A Fiber is a lightweight means of scheduling work that enables multiple units of processing to execut...
Definition: Fiber.ContinueWith.cs:8
An instruction to stop fiber execution and set a result on the fiber.
Definition: FiberResult.cs:8
Represents a fiber instruction to be processed by a FiberScheduler.
Definition: FiberInstruction.cs:43
A Fiber Factory for creating fibers with the same options.
Definition: FiberFactory.cs:9
Fiber(Action action)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:336
Fiber(IEnumerator coroutine, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:323
void Start()
Start executing the fiber using the default scheduler on the thread.
Definition: Fiber.cs:443
Fiber(Func< FiberInstruction > func)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:391
Yield execution to a specific fiber belonging to the same scheduler as the current fiber...
Definition: YieldToFiber.cs:35
static YieldToAnyFiber YieldToAnyFiber
An instruction to cause the current fiber to yield to any ready fiber.
Definition: FiberInstruction.cs:48
static FiberScheduler Current
Gets the default fiber scheduler for the thread.
Definition: FiberScheduler.cs:75
Fiber(Func< object, FiberInstruction > func, object state)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:418
Fiber(Func< object, FiberInstruction > func, object state, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:432
Fiber(Func< FiberInstruction > func, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:402
An instruction to terminate execution of the current fiber.
Definition: StopInstruction.cs:37
Fiber(IEnumerator coroutine)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:312
void Start(FiberScheduler scheduler)
Start executing the fiber using the specified scheduler.
Definition: Fiber.cs:458
Definition: IStructuralComparable.cs:33
Fiber(Action action, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:347
static StopInstruction Stop
An instruction to terminate execution of the current fiber.
Definition: FiberInstruction.cs:53
When no continuation options are specified, default behavior should be used to execute a continuation...
static Fiber CurrentFiber
Gets the currently executing fiber on this thread.
Definition: Fiber.cs:107
Definition: AotInterlocked.cs:3