()
| 169 | * @since 2.0.0 |
| 170 | */ |
| 171 | export const make = <K, A = unknown, E = unknown>(): Effect.Effect<FiberMap<K, A, E>, never, Scope.Scope> => |
| 172 | Effect.acquireRelease( |
| 173 | Effect.sync(() => |
| 174 | makeUnsafe<K, A, E>( |
| 175 | MutableHashMap.empty(), |
| 176 | Deferred.makeUnsafe() |
| 177 | ) |
| 178 | ), |
| 179 | (map) => |
| 180 | Effect.suspend(() => { |
| 181 | const state = map.state |
| 182 | if (state._tag === "Closed") return Effect.void |
| 183 | map.state = { _tag: "Closed" } |
| 184 | return Fiber.interruptAll(state.fibers).pipe( |
| 185 | Deferred.into(map.deferred) |
| 186 | ) |
| 187 | }) |
| 188 | ) |
| 189 | |
| 190 | /** |
| 191 | * Creates a scoped run function that forks effects into a new `FiberMap`. |
no test coverage detected