* Execute an async function while holding the lock
(fn: () => Promise<T>)
| 619 | * Execute an async function while holding the lock |
| 620 | */ |
| 621 | async withLockAsync<T>(fn: () => Promise<T>): Promise<T> { |
| 622 | this.acquire(); |
| 623 | try { |
| 624 | return await fn(); |
| 625 | } finally { |
| 626 | this.release(); |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | /** |
| 631 | * Check if a process is still running |
no test coverage detected