effect-io-ai

Package: effect
Module: Effect

Effect.makeSemaphore

Creates a new semaphore with the specified number of permits.

Details

This function initializes a semaphore that controls concurrent access to a shared resource. The number of permits determines how many tasks can access the resource concurrently.

Example

import { Effect } from "effect"

// Create a semaphore with 3 permits
const mutex = Effect.makeSemaphore(3)

Signature

declare const makeSemaphore: (permits: number) => Effect<Semaphore>

Source

Since v2.0.0