Пример #1
0
        /// <summary>
        /// </summary>
        protected sealed override void OnStop()
        {
            if (_this == this)
            {
                _this = null;
            }

            lock (_jobsSyncRoot)
            {
                try { _jobsList.Clear(); }
                catch { }

                try
                {
                    var timer = _jobsTimer;
                    _jobsTimer = null;
                    timer?.Change(Timeout.Infinite, Timeout.Infinite);
                }
                catch { }
            }
        }
Пример #2
0
 /// <summary>
 /// </summary>
 protected sealed override void OnStarted()
 {
     _this      = this;
     _jobsTimer = new Timer(new TimerCallback(state => CheckTasks()), null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
 }