Hyperlinkv0.8.0-beta.28

PartitionedSemaphore

PartitionedSemaphore.availableconsteffect/PartitionedSemaphore.ts:353
<K>(self: PartitionedSemaphore<K>): Effect.Effect<number>

Gets the current number of available permits.

When to use

Use to inspect a snapshot of how many permits are currently free.

Details

Running the returned effect reads the semaphore's current availability. Taking permits decreases availability, and releasing permits can increase it up to the semaphore capacity.

Gotchas

Reading availability does not reserve permits.

export const available = <K>(self: PartitionedSemaphore<K>): Effect.Effect<number> => self.available