public void Stopped(int exitCode) { lock (_stoppedLock) { if (_stopped) { return; } _stopped = true; } StoppedPrivate?.Invoke(exitCode); }
public async Task StoppedAsync(int stoppedCode, CancellationToken cancellationToken = default) { lock (_stoppedLock) { if (_stopped) { return; } _stopped = true; _stoppedCode = stoppedCode; _stoppedCancelationToken = cancellationToken; } await StoppedPrivate.Invoke(stoppedCode, cancellationToken); }