effect-io-ai

Package: effect
Module: TxReentrantLock

TxReentrantLock.writeLocks

Returns the number of write locks held (0 or the reentrant count).

Example (Counting write locks)

import { Effect, TxReentrantLock } from "effect"

const program = Effect.gen(function*() {
  const lock = yield* TxReentrantLock.make()
  const count = yield* TxReentrantLock.writeLocks(lock)
  console.log(count) // 0
})

Signature

declare const writeLocks: (self: TxReentrantLock) => Effect.Effect<number>

Source

Since v2.0.0