Package: effect
Module: TxReentrantLock
Returns the total number of read locks held across all fibers.
Example (Counting read locks)
import { Effect, TxReentrantLock } from "effect"
const program = Effect.gen(function*() {
const lock = yield* TxReentrantLock.make()
yield* TxReentrantLock.acquireRead(lock)
const count = yield* TxReentrantLock.readLocks(lock)
console.log(count) // 1
yield* TxReentrantLock.releaseRead(lock)
})
Signature
declare const readLocks: (self: TxReentrantLock) => Effect.Effect<number>
Since v2.0.0