示例#1
0
        public Task StopAsync()
        {
            Interlocked.CompareExchange(ref _state, StateStoppingOrStopped, StateStarted);

            if (_state != StateStoppingOrStopped)
            {
                throw new InvalidOperationException("The host has not yet starteds");
            }

            Console.WriteLine($"Stopping {Configuration.ApplicationName}");

            _shutdown.Stop();

            _watcher.Stop();

            _cancellationtokensource.Dispose();

            return(Task.FromResult(0));
        }
示例#2
0
 public void Shutdown()
 {
     _shutdown.Stop();
 }