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