MCPcopy
hub / github.com/colbymchenry/codegraph / acquire

Method acquire

src/utils.ts:384–400  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

382 * @returns A release function to call when done
383 */
384 async acquire(): Promise<() => void> {
385 while (this.locked) {
386 await new Promise<void>((resolve) => {
387 this.waitQueue.push(resolve);
388 });
389 }
390
391 this.locked = true;
392
393 return () => {
394 this.locked = false;
395 const next = this.waitQueue.shift();
396 if (next) {
397 next();
398 }
399 };
400 }
401
402 /**
403 * Execute a function while holding the lock

Callers 5

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

Calls

no outgoing calls

Tested by

no test coverage detected