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

Method acquire

src/utils.ts:693–709  ·  view source on GitHub ↗

* Acquire the lock * * @returns A release function to call when done

()

Source from the content-addressed store, hash-verified

691 * @returns A release function to call when done
692 */
693 async acquire(): Promise<() => void> {
694 while (this.locked) {
695 await new Promise<void>((resolve) => {
696 this.waitQueue.push(resolve);
697 });
698 }
699
700 this.locked = true;
701
702 return () => {
703 this.locked = false;
704 const next = this.waitQueue.shift();
705 if (next) {
706 next();
707 }
708 };
709 }
710
711 /**
712 * Execute a function while holding the lock

Callers 9

withLockMethod · 0.95
indexAllMethod · 0.45
indexFilesMethod · 0.45
syncMethod · 0.45
runDeferredSynthesisMethod · 0.45
security.test.tsFile · 0.45

Calls 2

pushMethod · 0.80
nextFunction · 0.50

Tested by

no test coverage detected