1711
1712
run(taskId: number, promise: Promise<void>, onCancel?: () => void,): Promise<void> {
1713
>
this._running = { taskId, cancel: () => onCancel?.(), promise };
async.ts
1714
>
1715
>
promise.then(() => this.doneRunning(taskId), () => this.doneRunning(taskId));
1716
>
1717
>
return promise;
1718
>
}
1719
1720
private doneRunning(taskId: number): void {
1721
>
if (this._running && taskId === this._running.taskId) {
async.ts
1722
>
1723
>
// only set running to done if the promise finished that is associated with that taskId
1724
>
this._running = undefined;
1725
>
1726
>
// schedule the queued task now that we are free if we have any
1727
>
this.runQueued();
1728
>
}
1729
>
}
1730
1731
private runQueued(): void {
1733
const queued = this._queued;
1734
this._queued = undefined;