()
| 56 | } |
| 57 | |
| 58 | unsafeRebuild(): Effect.Effect<void, E> { |
| 59 | const s = this.state.current |
| 60 | if (s._tag === "Closed") { |
| 61 | return Effect.interrupt |
| 62 | } |
| 63 | const prevScope = s.scope |
| 64 | const scope = Effect.runSync(Scope.make()) |
| 65 | this.latch.unsafeClose() |
| 66 | MutableRef.set(this.state, { _tag: "Acquiring", scope }) |
| 67 | return Effect.fiberIdWith((fiberId) => { |
| 68 | internalInterruptors.add(fiberId) |
| 69 | return Scope.close(prevScope, Exit.void) |
| 70 | }).pipe( |
| 71 | Effect.andThen(this.acquire(scope)), |
| 72 | Effect.flatMap((value) => { |
| 73 | if (this.state.current._tag === "Closed") { |
| 74 | return Effect.interrupt |
| 75 | } |
| 76 | MutableRef.set(this.state, { _tag: "Acquired", scope, value }) |
| 77 | return this.latch.open |
| 78 | }) |
| 79 | ) |
| 80 | } |
| 81 | |
| 82 | await: Effect.Effect<A> = Effect.suspend(() => { |
| 83 | const s = this.state.current |
no test coverage detected