Пример #1
0
        /// <summary>
        /// Attempts to gracefully stop the host with the given timeout.
        /// </summary>
        /// <param name="host"></param>
        /// <param name="timeout">The timeout for stopping gracefully. Once expired the
        /// server may terminate any remaining active connections.</param>
        /// <returns></returns>
        //public static Task StopAsync(this IAppHost host, TimeSpan timeout)
        //{
        //	return host.StopAsync(new CancellationTokenSource(timeout).Token);
        //}

        /// <summary>
        /// Block the calling thread until shutdown is triggered via Ctrl+C or SIGTERM.
        /// </summary>
        /// <param name="host">The running <see cref="IAppHost"/>.</param>
        public static void WaitForShutdown(this IAppHost host)
        {
            host.WaitForShutdownAsync().GetAwaiter().GetResult();
        }