Exemplo n.º 1
0
        public WebJobHost()
        {
            _shutdownTokenSource = new CancellationTokenSource();
            _shutdownWatcher     = WebJobShutdownWatcher.Create(_shutdownTokenSource);
            _stoppingTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_shutdownTokenSource.Token);

            // support cancel keys
            Console.CancelKeyPress += OnCancelKeyPress;
        }
Exemplo n.º 2
0
        internal static WebJobShutdownWatcher Create(CancellationTokenSource cancellationTokenSource)
        {
            var watcher = new WebJobShutdownWatcher(cancellationTokenSource, false);

            if (watcher._watcher != null)
            {
                return(watcher);
            }

            watcher.Dispose();
            return(null);
        }