コード例 #1
0
 public void stop()
 {
     if (_eventLoop.IsShuttingDown)
     {
         return;
     }
     _eventLoop.ShutdownGracefullyAsync();
 }
コード例 #2
0
        public async Task StopAsync(CancellationToken cancellationToken)
        {
            if (_workerThread == null)
            {
                return;
            }

            await _workerThread.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(300), TimeSpan.FromSeconds(2));

            _workerThread = null;
        }
コード例 #3
0
        public void GracefulShutdownAfterStart()
        {
            IEventLoop     loop  = NewEventLoopGroup().GetNext();
            CountdownEvent latch = new CountdownEvent(1);

            loop.Execute(() => latch.Signal());

            // Wait for the event loop thread to start.
            Assert.True(latch.Wait(TimeSpan.FromMinutes(1)));

            // Request the event loop thread to stop.
            loop.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(200), TimeSpan.FromSeconds(3));

            // Wait until the event loop is terminated.
            Assert.True(loop.TerminationCompletion.Wait(TimeSpan.FromMilliseconds(500)));

            AssertRejection(loop);
        }
コード例 #4
0
 private void ShutdownThreads()
 {
     _socketListenerThreads.ShutdownGracefullyAsync(TimeSpan.Zero, TimeSpan.Zero).WaitEx();
     _socketWorkerThreads.ShutdownGracefullyAsync(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5)).WaitEx();
     _workerThread.ShutdownGracefullyAsync(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5)).WaitEx();
 }