MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / withDaemonRegistryMutationLock

Function withDaemonRegistryMutationLock

src/daemon/daemon-registry.ts:167–191  ·  view source on GitHub ↗
(
  workspaceKey: string,
  callback: () => T,
  existingLock?: DaemonRegistryMutationLock,
)

Source from the content-addressed store, hash-verified

165}
166
167function withDaemonRegistryMutationLock<T>(
168 workspaceKey: string,
169 callback: () => T,
170 existingLock?: DaemonRegistryMutationLock,
171): T | null {
172 if (existingLock) {
173 if (existingLock.workspaceKey !== workspaceKey) {
174 throw new Error(
175 `Daemon registry lock for ${existingLock.workspaceKey} cannot guard ${workspaceKey}`,
176 );
177 }
178 return callback();
179 }
180
181 const lock = acquireDaemonRegistryMutationLock(workspaceKey);
182 if (!lock) {
183 return null;
184 }
185
186 try {
187 return callback();
188 } finally {
189 lock.release();
190 }
191}
192
193function entryMatchesCleanupTarget(
194 entry: DaemonRegistryEntry,

Callers 2

writeDaemonRegistryEntryFunction · 0.85

Calls 2

releaseMethod · 0.65

Tested by

no test coverage detected