effect-io-ai

Package: effect
Module: TxReentrantLock

TxReentrantLock.writeLocked

Checks whether any fiber holds a write lock.

Example (Checking whether a write lock is held)

import { Effect, TxReentrantLock } from "effect"

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

Signature

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

Source

Since v2.0.0