Context.Reference<boolean>Context reference that controls whether the runtime should bypass scheduler
yield checks. When set to true, the fiber run loop won't call
Scheduler.shouldYield.
When to use
Use to bypass scheduler yield checks for controlled runtime workloads where cooperative yielding should be disabled.
Gotchas
Setting this reference to true can let long-running fibers monopolize the
JavaScript thread.
export const const PreventSchedulerYield: Context.Reference<boolean>const PreventSchedulerYield: {
defaultValue: () => Shape;
of: (this: void, self: boolean) => boolean;
context: (self: boolean) => Context.Context<never>;
use: (f: (service: boolean) => Effect<A, E, R>) => Effect<A, E, R>;
useSync: (f: (service: boolean) => A) => Effect<A, never, never>;
Identifier: Identifier;
Service: Shape;
key: string;
stack: string | undefined;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
Context reference that controls whether the runtime should bypass scheduler
yield checks. When set to true, the fiber run loop won't call
Scheduler.shouldYield.
When to use
Use to bypass scheduler yield checks for controlled runtime workloads where
cooperative yielding should be disabled.
Gotchas
Setting this reference to true can let long-running fibers monopolize the
JavaScript thread.
PreventSchedulerYield = import ContextContext.Reference<boolean>("effect/Scheduler/PreventSchedulerYield", {
defaultValue: () => booleandefaultValue: () => false
})