Default ctor
Fiber which embeds neccessary info for FiberScheduler
Creates a new Fiber which calls the given delegate.
Disables Fiber switching
Enables Fiber switching
Schedule a task to be run next time the scheduler yields
This created a new Fiber for the supplied op and adds it to the dispatch list.
This creates a new Fiber for the supplied op and then starts the dispatcher.
Resource type that will be tracked by FiberScheduler
If the caller is a scheduled Fiber, this yields execution to another scheduled Fiber.
If the caller is a scheduled Fiber, this yields execution to another scheduled Fiber.
Ensure argument to start is run first
{ scope sched = new FiberScheduler(); bool startHasRun; sched.spawn(() => assert(startHasRun)); sched.start(() { startHasRun = true; }); } { scope sched = new FiberScheduler(); bool startHasRun; sched.schedule(() => assert(startHasRun)); sched.start(() { startHasRun = true; }); }
An example Scheduler using Fibers.
This is an example scheduler that creates a new Fiber per call to spawn and multiplexes the execution of all fibers within the main thread.