Пример #1
0
 public void Stopped(int exitCode)
 {
     lock (_stoppedLock)
     {
         if (_stopped)
         {
             return;
         }
         _stopped = true;
     }
     StoppedPrivate?.Invoke(exitCode);
 }
Пример #2
0
        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);
        }