effect-io-ai

Package: effect
Module: PartitionedSemaphore

PartitionedSemaphore.release

Returns an effect that releases permits back to the shared pool and returns the current available permit count.

When to use

Use when you need to return permits acquired with take in a lower-level partitioned permit protocol with explicit release control.

Details

Released permits are first assigned to waiting partitions in round-robin order. Only permits not needed by waiters increase the available count, which is capped at the semaphore capacity.

See

Signature

declare const release: { (permits: number): <K>(self: PartitionedSemaphore<K>) => Effect.Effect<number>; <K>(self: PartitionedSemaphore<K>, permits: number): Effect.Effect<number>; }

Source

Since v4.0.0