scheduler

The scheduler implements a simple round-robin fiber scheduler.

Scheduler

static add(callable)

Adds a fiber to the schedule. It will eventually run when Scheduler.next() is called.

static await(fn)

Calls fn and then switches to the next scheduled fiber.

The expectation is that the fn called will ultimately pass Fiber.current to some asynchronous operation that will resume the fiber once the operation completes.

Scheduler.await {
  async_operation(Fiber.current, ...)
}

static next()

Transfers control to the next fiber in the schedule.