()
| 699 | }, |
| 700 | |
| 701 | async stop(): Promise<void> { |
| 702 | if (disposed) return; |
| 703 | if (fatal !== null) throw fatal; |
| 704 | if (worker === null) return; |
| 705 | |
| 706 | if (stopDef !== null) { |
| 707 | await stopDef.promise; |
| 708 | return; |
| 709 | } |
| 710 | |
| 711 | stopDef = deferred<void>(); |
| 712 | stopSettled = false; |
| 713 | stopRequested = true; |
| 714 | send({ type: "shutdown" }); |
| 715 | await stopDef.promise; |
| 716 | if (exitDef !== null) await exitDef.promise; |
| 717 | }, |
| 718 | |
| 719 | dispose(): void { |
| 720 | if (disposed) return; |