src/vs/workbench/services/lifecycle/electron-sandbox/lifecycleService.ts/NativeLifecycleService/handleWillShutdown
class NativeLifecycleService:	private async handleWillShutdown(reason: ShutdownReason): Promise<void> {
		const joiners: Promise<void>[] = [];
		const pendingJoiners = new Set<string>();

		this._onWillShutdown.fire({
			join(promise, id) {
				joiners.push(promise);

				// Track promise completion
				pendingJoiners.add(id);
				promise.finally(() => pendingJoiners.delete(id));
			},
			reason
		});

		const longRunningWillShutdownWarning = disposableTimeout(() => {
			this.logService.warn(`[lifecycle] onWillShutdown is taking a long time, pending operations: ${Array.from(pendingJoiners).join(', ')}`);
		}, NativeLifecycleService.WILL_SHUTDOWN_WARNING_DELAY);

		try {
			await Promises.settled(joiners);
		} catch (error) {
			this.onShutdownError(reason, error);
		} finally {
			longRunningWillShutdownWarning.dispose();
		}
	}