effect-io-ai

Package: effect
Module: TxReentrantLock

TxReentrantLock.readLocked

Checks whether any fiber holds a read lock.

Example (Checking whether a read lock is held)

import { Effect, TxReentrantLock } from "effect"

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

Signature

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

Source

Since v2.0.0