| 5350 | readonly uninterruptible?: boolean | "inherit" | undefined |
| 5351 | } | undefined |
| 5352 | ): [Arg] extends [Effect.Effect<infer _A, infer _E, infer _R>] ? |
| 5353 | Effect.Effect<Fiber.Fiber<_A, _E>, never, _R | Scope.Scope> |
| 5354 | : <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<Fiber.Fiber<A, E>, never, R | Scope.Scope> |
| 5355 | } = dual((args) => isEffect(args[0]), <A, E, R>( |
| 5356 | self: Effect.Effect<A, E, R>, |
| 5357 | options?: { |
| 5358 | readonly startImmediately?: boolean |
| 5359 | readonly uninterruptible?: boolean | "inherit" |
| 5360 | } |
| 5361 | ): Effect.Effect<Fiber.Fiber<A, E>, never, R | Scope.Scope> => flatMap(scope, (scope) => forkIn(self, scope, options))) |
| 5362 | |
| 5363 | // ---------------------------------------------------------------------------- |
| 5364 | // execution |
| 5365 | // ---------------------------------------------------------------------------- |
| 5366 | |
| 5367 | /** @internal */ |
| 5368 | export const runForkWith = <R>(context: Context.Context<R>) => |
| 5369 | <A, E>( |
| 5370 | effect: Effect.Effect<A, E, R>, |
| 5371 | options?: Effect.RunOptions | undefined |
| 5372 | ): Fiber.Fiber<A, E> => { |
| 5373 | const fiber = new FiberImpl<A, E>( |
| 5374 | options?.scheduler ? Context.add(context, Scheduler.Scheduler, options.scheduler) : context, |
| 5375 | options?.uninterruptible !== true |
| 5376 | ) |
| 5377 | fiber.evaluate(effect as any) |
| 5378 | if (fiber._exit) return fiber |
| 5379 | |
| 5380 | if (options?.signal) { |
| 5381 | if (options.signal.aborted) { |
| 5382 | fiber.interruptUnsafe() |
| 5383 | } else { |
| 5384 | const abort = () => fiber.interruptUnsafe() |
| 5385 | options.signal.addEventListener("abort", abort, { once: true }) |
| 5386 | fiber.addObserver(() => options.signal!.removeEventListener("abort", abort)) |
| 5387 | } |
| 5388 | } |
| 5389 | if (options?.onFiberStart) { |
| 5390 | options.onFiberStart(fiber) |
| 5391 | } |
| 5392 | return fiber |
| 5393 | } |
| 5394 | |
| 5395 | /** @internal */ |
| 5396 | export const fiberRunIn: { |
| 5397 | (scope: Scope.Scope): <A, E>(self: Fiber.Fiber<A, E>) => Fiber.Fiber<A, E> |
| 5398 | <A, E>( |
| 5399 | self: Fiber.Fiber<A, E>, |
| 5400 | scope: Scope.Scope |
| 5401 | ): Fiber.Fiber<A, E> |
| 5402 | } = dual(2, <A, E>( |
| 5403 | self: FiberImpl<A, E>, |
| 5404 | scope: Scope.Scope |
| 5405 | ): Fiber.Fiber<A, E> => { |
| 5406 | if (self._exit) { |
| 5407 | return self |
| 5408 | } else if (scope.state._tag === "Closed") { |
| 5409 | self.interruptUnsafe(self.id) |
nothing calls this directly
no test coverage detected
searching dependent graphs…