Package: effect
Module: Semaphore
Releases the specified number of permits and returns the resulting available permits.
When to use
Use when you need to return permits acquired with take in a lower-level
permit protocol with explicit release control.
Details
Running the effect releases the requested permits, wakes waiting acquirers when permits become available, and returns the current available permit count.
Gotchas
Manual take / release usage must keep permit counts balanced. Prefer
withPermit or withPermits when the acquisition can be scoped to one
effect.
See
take for manually acquiring permitsreleaseAll for returning every currently taken permitwithPermits for automatic acquire and release around an effectSignature
declare const release: { (permits: number): (self: Semaphore) => Effect.Effect<number>; (self: Semaphore, permits: number): Effect.Effect<number>; }
Since v4.0.0