effect-io-ai

Package: effect
Module: TxReentrantLock

TxReentrantLock.locked

Checks whether the lock is held by any fiber (read or write).

Example (Checking whether a lock is held)

import { Effect, TxReentrantLock } from "effect"

const program = Effect.gen(function*() {
  const lock = yield* TxReentrantLock.make()
  const isLocked = yield* TxReentrantLock.locked(lock)
  console.log(isLocked) // false
})

Signature

declare const locked: (self: TxReentrantLock) => Effect.Effect<boolean>

Source

Since v2.0.0