(permits: number): (self: Semaphore) => Effect.Effect<void>
(self: Semaphore, permits: number): Effect.Effect<void>Sets the total number of permits managed by the semaphore.
When to use
Use to change the concurrency limit of an existing semaphore while keeping current acquisitions in place.
Details
Existing acquisitions remain taken after resizing. If the new total is less than the currently taken permit count, new acquisitions wait until enough permits are released.
export const const resize: {
(permits: number): (
self: Semaphore
) => Effect.Effect<void>
(
self: Semaphore,
permits: number
): Effect.Effect<void>
}
Sets the total number of permits managed by the semaphore.
When to use
Use to change the concurrency limit of an existing semaphore while keeping
current acquisitions in place.
Details
Existing acquisitions remain taken after resizing. If the new total is less
than the currently taken permit count, new acquisitions wait until enough
permits are released.
resize: {
(permits: numberpermits: number): (self: Semaphore(parameter) self: {
resize: (this: Semaphore, permits: number) => Effect.Effect<void>;
withPermits: (this: Semaphore, permits: number) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermit: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermitsIfAvailable: (this: Semaphore, permits: number) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E, R>;
take: (this: Semaphore, permits: number) => Effect.Effect<number>;
release: (this: Semaphore, permits: number) => Effect.Effect<number>;
releaseAll: Effect.Effect<number>;
}
self: Semaphore) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<void>
(self: Semaphore(parameter) self: {
resize: (this: Semaphore, permits: number) => Effect.Effect<void>;
withPermits: (this: Semaphore, permits: number) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermit: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermitsIfAvailable: (this: Semaphore, permits: number) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E, R>;
take: (this: Semaphore, permits: number) => Effect.Effect<number>;
release: (this: Semaphore, permits: number) => Effect.Effect<number>;
releaseAll: Effect.Effect<number>;
}
self: Semaphore, permits: numberpermits: number): import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<void>
} = import dualdual(2, (self: Semaphore(parameter) self: {
resize: (this: Semaphore, permits: number) => Effect.Effect<void>;
withPermits: (this: Semaphore, permits: number) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermit: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermitsIfAvailable: (this: Semaphore, permits: number) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E, R>;
take: (this: Semaphore, permits: number) => Effect.Effect<number>;
release: (this: Semaphore, permits: number) => Effect.Effect<number>;
releaseAll: Effect.Effect<number>;
}
self: Semaphore, permits: numberpermits: number) => self: Semaphore(parameter) self: {
resize: (this: Semaphore, permits: number) => Effect.Effect<void>;
withPermits: (this: Semaphore, permits: number) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermit: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermitsIfAvailable: (this: Semaphore, permits: number) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E, R>;
take: (this: Semaphore, permits: number) => Effect.Effect<number>;
release: (this: Semaphore, permits: number) => Effect.Effect<number>;
releaseAll: Effect.Effect<number>;
}
self.Semaphore.resize(this: Semaphore, permits: number): Effect.Effect<void>Adjusts the number of permits available in the semaphore.
When to use
Use to change the total permit count of an existing semaphore.
resize(permits: numberpermits))