* Execute an async function while holding the lock
(fn: () => Promise<T>)
| 311 | * Execute an async function while holding the lock |
| 312 | */ |
| 313 | async withLockAsync<T>(fn: () => Promise<T>): Promise<T> { |
| 314 | this.acquire(); |
| 315 | try { |
| 316 | return await fn(); |
| 317 | } finally { |
| 318 | this.release(); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | /** |
| 323 | * Check if a process is still running |
no test coverage detected