Fiber.cs
Go to the documentation of this file.
374 public Fiber (Action<object> action, object state) : this (action, state, CancellationToken.None)
429 public Fiber (Func<object, FiberInstruction> func, object state) : this (func, state, CancellationToken.None)
443 public Fiber (Func<object, FiberInstruction> func, object state, CancellationToken cancellationToken)
475 var originalState = (FiberStatus)Interlocked.CompareExchange (ref status, (int)FiberStatus.WaitingToRun, (int)FiberStatus.Created);
477 originalState = (FiberStatus)Interlocked.CompareExchange (ref status, (int)FiberStatus.WaitingToRun, (int)FiberStatus.WaitingForActivation);
479 throw new InvalidOperationException ("A fiber cannot be started again once it has begun running or has completed.");
528 throw new InvalidOperationException ("An attempt was made to execute a completed Fiber. This indicates a logic error in the scheduler.");
563 Interlocked.CompareExchange (ref status, (int)FiberStatus.WaitingToRun, (int)FiberStatus.Created);
564 Interlocked.CompareExchange (ref status, (int)FiberStatus.Running, (int)FiberStatus.WaitingToRun);
626 instruction = new YieldUntilComplete (Fiber.Factory.StartNew (result as IEnumerator, cancelToken, scheduler));
642 if (instruction is YieldUntilComplete && ((YieldUntilComplete)instruction).Fiber.Scheduler != FiberScheduler.Current)
643 throw new InvalidOperationException ("Currently only fibers belonging to the same scheduler may be yielded to. FiberScheduler.Current = "
645 + ", Fiber.Scheduler = " + (((YieldUntilComplete)instruction).Fiber.Scheduler == null ? "null" : ((YieldUntilComplete)instruction).Fiber.Scheduler.ToString ()));
650 Interlocked.CompareExchange (ref yieldToFiberInstruction.Fiber.status, (int)FiberStatus.WaitingToRun, (int)FiberStatus.Created);
651 var originalState = (FiberStatus)Interlocked.CompareExchange (ref yieldToFiberInstruction.Fiber.status, (int)FiberStatus.Running, (int)FiberStatus.WaitingToRun);
661 throw new InvalidOperationException ("Currently only fibers belonging to the same scheduler may be yielded to. FiberScheduler.Current = "
663 + ", 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:388
Fiber(Action< object > action, object state)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:374
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
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:347
Fiber(IEnumerator coroutine, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:334
void Start()
Start executing the fiber using the default scheduler on the thread.
Definition: Fiber.cs:454
Fiber(Func< FiberInstruction > func)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:402
Interface used by Fiber to access protected methods of the scheduler.
Definition: IFiberScheduler.cs:38
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:429
Fiber(Func< object, FiberInstruction > func, object state, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:443
Fiber(Func< FiberInstruction > func, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:413
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:323
void Start(FiberScheduler scheduler)
Start executing the fiber using the specified scheduler.
Definition: Fiber.cs:469
Definition: IStructuralComparable.cs:33
Fiber(Action action, CancellationToken cancellationToken)
Initializes a new instance of the SpicyPixel.Threading.Fiber class.
Definition: Fiber.cs:358
Definition: Fiber.ContinueWith.cs:6
When no continuation options are specified, default behavior should be used to execute a continuation...
Definition: AotInterlocked.cs:3