示例#1
0
        /// <summary>
        /// Starts this instance.
        /// </summary>
        public void Start()
        {
            if (_workerThread != null)
            {
                //Clean up previous instances before trying to restart
                _worker.StopProcessing = true;
                _workerThread.Interrupt();
                _workerThread.Join(1000 * 60);
                if (_workerThread.IsAlive)
                {
                    _workerThread.Abort();
                }
                _workerThread = null;
            }

            string threadName = _worker.GetType() + "Thread";

            _workerThread = new Thread(_worker.Run)
            {
                Name = threadName
            };
            _workerThread.Start();
        }