| 538 | |
| 539 | /** @internal */ |
| 540 | export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> { |
| 541 | constructor( |
| 542 | context: Context.Context<never>, |
| 543 | interruptible: boolean = true, |
| 544 | parent?: FiberImpl<any, any> |
| 545 | ) { |
| 546 | this.setContext(context) |
| 547 | this.id = ++nextFiberId |
| 548 | this.currentOpCount = 0 |
| 549 | this.interruptible = interruptible |
| 550 | this._stack = [] |
| 551 | this._observers = undefined |
| 552 | this._exit = undefined |
| 553 | this._children = undefined |
| 554 | this._interruptedCause = undefined |
| 555 | this._yielded = undefined |
| 556 | this._autoYielded = false |
| 557 | this._running = false |
| 558 | this._deferredInterrupt = false |
| 559 | this._parent = undefined |
| 560 | this._asyncContext = undefined |
| 561 | this.cache.runtimeMetrics?.recordFiberStart(this.context) |
| 562 | this.supervisor = this.cache.supervisor |
| 563 | this.supervisor?.onStart(this, parent) |
| 564 | } |
| 565 | |
| 566 | get [FiberTypeId](): Fiber.Fiber.Variance<A, E> { |
| 567 | return fiberVariance |
| 568 | } |
| 569 | |
| 570 | declare readonly id: number |
| 571 | declare interruptible: boolean |
| 572 | declare readonly supervisor: Supervisor.Supervisor | undefined |
| 573 | declare currentOpCount: number |
| 574 | declare readonly _stack: Array<Primitive> |
| 575 | declare _observers: Array<(exit: Exit.Exit<A, E>) => void> | undefined |
| 576 | declare _exit: Exit.Exit<A, E> | undefined |
| 577 | declare _children: Set<FiberImpl<any, any>> | undefined |
| 578 | declare _interruptedCause: Cause.Cause<never> | undefined |
| 579 | declare _yielded: Exit.Exit<any, any> | (() => void) | undefined |
| 580 | declare _autoYielded: boolean |
| 581 | declare _running: boolean |
| 582 | declare _deferredInterrupt: boolean |
| 583 | declare _parent: FiberImpl<any, any> | undefined |
| 584 | declare _asyncContext: AsyncContext | undefined |
| 585 | |
| 586 | // set in setContext |
| 587 | declare context: Context.Context<never> |
| 588 | declare cache: Fiber.Fiber.Cache |
| 589 | |
| 590 | declare _dispatcher: Scheduler.SchedulerDispatcher | undefined |
| 591 | get currentDispatcher(): Scheduler.SchedulerDispatcher { |
| 592 | return this._dispatcher ??= this.cache.scheduler.makeDispatcher() |
| 593 | } |
| 594 | |
| 595 | getRef<X>(ref: Context.Reference<X>): X { |
| 596 | return Context.getReferenceUnsafe(this.context, ref) |
| 597 | } |
nothing calls this directly
no outgoing calls
no test coverage detected