| 537 | } |
| 538 | |
| 539 | private async triggerOnDidStartKernel(disableUI: boolean, isRestarting = false) { |
| 540 | if (disableUI) { |
| 541 | return; |
| 542 | } |
| 543 | |
| 544 | // If we started and the UI is no longer disabled (ie., a user executed a cell) |
| 545 | // then we can signal that the kernel was created and can be used by third-party extensions. |
| 546 | // We also only want to fire off a single event here. |
| 547 | if (!this._postInitializedOnStartPromise || isRestarting) { |
| 548 | this._isPostInitializedInProgress = true; |
| 549 | this._postInitializedOnStartPromise = this._onPostInitialized.fireAsync({}, this.startCancellation.token); |
| 550 | void this._postInitializedOnStartPromise.finally(() => (this._isPostInitializedInProgress = false)); |
| 551 | } |
| 552 | |
| 553 | // Do not enable this, end up in a dead lock. |
| 554 | // E.g. extension `A` waits for `onDidStart` event, and then calls `executeCode` API. |
| 555 | // However the `executeCode` API waits for `onDidStart` event to be fired and completed, but thats still waiting for ext `A` to complete. |
| 556 | // Hence a deadlock. |
| 557 | await this._postInitializedOnStartPromise; |
| 558 | } |
| 559 | |
| 560 | private async interruptExecution( |
| 561 | session: IKernelSession, |