(self: Pool<A, E>)
| 506 | * @since 2.0.0 |
| 507 | */ |
| 508 | export const get = <A, E>(self: Pool<A, E>): Effect.Effect<A, E, Scope.Scope> => |
| 509 | core.withFiber((fiber) => { |
| 510 | const state = self.state |
| 511 | if (state.isShuttingDown) return internal.interrupt |
| 512 | if (state.waiters.size === 0 && state.availableHead?.exit._tag === "Success") { |
| 513 | state.usage++ |
| 514 | if (self.config.isFixed || targetSize(self) <= activeSize(self)) { |
| 515 | return leaseItem(self, state.availableHead, fiber) |
| 516 | } |
| 517 | state.usage-- |
| 518 | } |
| 519 | return getSlowWith(self, leaseItemWith) |
| 520 | }) |
| 521 | |
| 522 | /** |
| 523 | * Borrows an item while an effect runs and returns it when the effect exits. |
nothing calls this directly
no test coverage detected