(self: Latch): booleanCloses the latch synchronously so future await and whenOpen calls
suspend.
When to use
Use to close a latch synchronously when the state change must happen outside
an Effect.
Details
Returns true when this call changed the latch from open to closed, or
false if it was already closed. This unsafe variant performs the state
change immediately instead of returning an Effect.
export const const closeUnsafe: (
self: Latch
) => boolean
Closes the latch synchronously so future await and whenOpen calls
suspend.
When to use
Use to close a latch synchronously when the state change must happen outside
an Effect.
Details
Returns true when this call changed the latch from open to closed, or
false if it was already closed. This unsafe variant performs the state
change immediately instead of returning an Effect.
closeUnsafe = (self: Latch(parameter) self: {
open: Effect.Effect<boolean>;
openUnsafe: (this: Latch) => boolean;
release: Effect.Effect<boolean>;
await: Effect.Effect<void>;
close: Effect.Effect<boolean>;
closeUnsafe: (this: Latch) => boolean;
whenOpen: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
isOpen: (this: Latch) => boolean;
}
self: Latch): boolean => self: Latch(parameter) self: {
open: Effect.Effect<boolean>;
openUnsafe: (this: Latch) => boolean;
release: Effect.Effect<boolean>;
await: Effect.Effect<void>;
close: Effect.Effect<boolean>;
closeUnsafe: (this: Latch) => boolean;
whenOpen: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
isOpen: (this: Latch) => boolean;
}
self.Latch.closeUnsafe(this: Latch): booleanCloses the latch synchronously so future waiters suspend again.
When to use
Use when synchronous code must close the latch immediately.
closeUnsafe()