MCPcopy Create free account
hub / github.com/Effect-TS/effect / readLocks

Function readLocks

packages/effect/src/TxReentrantLock.ts:554–562  ·  view source on GitHub ↗
(self: TxReentrantLock)

Source from the content-addressed store, hash-verified

552 * @since 2.0.0
553 */
554export const readLocks = (self: TxReentrantLock): Effect.Effect<number> =>
555 Effect.gen(function*() {
556 const state = yield* TxRef.get(self.stateRef)
557 let total = 0
558 for (const [, count] of state.readers) {
559 total += count
560 }
561 return total
562 })
563
564/**
565 * Returns the number of write locks held (0 or the reentrant count).

Callers

nothing calls this directly

Calls 1

getMethod · 0.65

Tested by

no test coverage detected