Package: effect
Module: TxReentrantLock
Acquires a write lock for the duration of the scope. The lock is automatically released when the scope closes.
Example (Holding a scoped write lock)
import { Effect, TxReentrantLock } from "effect"
const program = Effect.gen(function*() {
const lock = yield* TxReentrantLock.make()
yield* Effect.scoped(
Effect.gen(function*() {
yield* TxReentrantLock.writeLock(lock)
// write lock is held for the duration of the scope
})
)
// write lock is released
})
Signature
declare const writeLock: (self: TxReentrantLock) => Effect.Effect<number, never, Scope.Scope>
Since v2.0.0