MCPcopy Index your code
hub / github.com/anomalyco/opencode / lock

Function lock

packages/opencode/src/snapshot/index.ts:57–64  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

55 const locks = new Map<string, Semaphore.Semaphore>()
56
57 const lock = (key: string) => {
58 const hit = locks.get(key)
59 if (hit) return hit
60
61 const next = Semaphore.makeUnsafe(1)
62 locks.set(key, next)
63 return next
64 }
65
66 const state = yield* InstanceState.make<State>(
67 Effect.fn("Snapshot.state")(function* (ctx) {

Callers 1

lockedFunction · 0.70

Calls 2

getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected