MCPcopy Create free account
hub / github.com/tiann/hapi / inLock

Method inLock

cli/src/utils/lock.ts:5–12  ·  view source on GitHub ↗
(func: () => Promise<T> | T)

Source from the content-addressed store, hash-verified

3 private promiseResolverQueue: Array<(v: boolean) => void> = [];
4
5 async inLock<T>(func: () => Promise<T> | T): Promise<T> {
6 try {
7 await this.lock();
8 return await func();
9 } finally {
10 this.unlock();
11 }
12 }
13
14 private async lock() {
15 if (this.permits > 0) {

Callers 8

updateMetadataMethod · 0.80
updateAgentStateMethod · 0.80
drainLockMethod · 0.80
enqueueMethod · 0.80
releaseItemMethod · 0.80
releaseToolCallMethod · 0.80
processQueueMethod · 0.80
flushMethod · 0.80

Calls 2

lockMethod · 0.95
unlockMethod · 0.95

Tested by

no test coverage detected