MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / withLockAsync

Method withLockAsync

src/utils.ts:647–654  ·  view source on GitHub ↗

* Execute an async function while holding the lock

(fn: () => Promise<T>)

Source from the content-addressed store, hash-verified

645 * Execute an async function while holding the lock
646 */
647 async withLockAsync<T>(fn: () => Promise<T>): Promise<T> {
648 this.acquire();
649 try {
650 return await fn();
651 } finally {
652 this.release();
653 }
654 }
655
656 /**
657 * Check if a process is still running

Callers 1

security.test.tsFile · 0.80

Calls 3

acquireMethod · 0.95
releaseMethod · 0.95
fnFunction · 0.50

Tested by

no test coverage detected