Where fibers run.
A scheduler runs short tasks one at a time and fires timers. Fibers never
touch threads or event loops directly; they only call schedule and
call_later. That keeps the fiber runtime the same no matter what drives
it:
SyncSchedulerruns everything on the calling thread and blocks while it waits for timers or for callbacks from other threads.AsyncioSchedulerruns on an asyncio event loop.
schedule is safe to call from any thread. call_later is only called
from fibers, which always run on the scheduler's own thread.
Both also serve the test clock: track counts the work a wake-up causes.
A fiber reads its scheduler and its yield budget from its context, as Effect does, so they can be provided per effect::
eff.pipe(provide_service(MaxOpsBeforeYield, 16))Classes#
On This Page
Classes