Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

TSemaphore

15 exports Since v2.0.0 Source

Constructors

Since v2.0.0

Signature

declare const make: (permits: number) => STM.STM<TSemaphore>

Getters

Signature

declare const available: (self: TSemaphore) => STM.STM<number>

Models

TSemaphore

interface
Since v2.0.0

Signature

interface TSemaphore extends Proto {}

Mutations

Since v2.0.0

Signature

declare const acquire: (self: TSemaphore) => STM.STM<void>
Since v2.0.0

Signature

declare const acquireN: {
(n: number): (self: TSemaphore) => STM<void>;
(self: TSemaphore, n: number): STM<void>;
}
Since v2.0.0

Signature

declare const release: (self: TSemaphore) => STM.STM<void>
Since v2.0.0

Signature

declare const releaseN: {
(n: number): (self: TSemaphore) => STM<void>;
(self: TSemaphore, n: number): STM<void>;
}

Signature

declare const withPermit: {
(semaphore: TSemaphore): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
<A, E, R>(self: Effect<A, E, R>, semaphore: TSemaphore): Effect<A, E, R>;
}

Signature

declare const withPermits: {
(semaphore: TSemaphore, permits: number): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
<A, E, R>(self: Effect<A, E, R>, semaphore: TSemaphore, permits: number): Effect<A, E, R>;
}

Signature

declare const withPermitScoped: (self: TSemaphore) => Effect.Effect<void, never, Scope.Scope>

Signature

declare const withPermitsScoped: {
(permits: number): (self: TSemaphore) => Effect<void, never, Scope>;
(self: TSemaphore, permits: number): Effect<void, never, Scope>;
}

Other

Symbols

Signature

declare const TSemaphoreTypeId: unique symbol

Signature

type TSemaphoreTypeId = typeof TSemaphoreTypeId

Unsafe

Signature

declare const unsafeMake: (permits: number) => TSemaphore