(filePath: string, fn: () => T)
| 38 | |
| 39 | /** Acquire the thread file lock, run fn, then release. */ |
| 40 | export function withThreadLock<T>(filePath: string, fn: () => T): T { |
| 41 | const release = acquireLock(filePath); |
| 42 | try { |
| 43 | return fn(); |
| 44 | } finally { |
| 45 | release(); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // ─── Short ID generation ─────────────────────────────────────────────────── |
| 50 |
no test coverage detected