Esempio n. 1
0
 /// <summary>
 /// Checks for locked worker threads and removes any which are locked.
 /// A worker thread is considered locked if a task does not finish within
 /// WorkerThreadTaskProcessTimeoutSeconds seconds.
 /// </summary>
 private void _checkForLockedWorkerThreads()
 {
     for (int i = 0; i < _workers.Count; i++)
     {
         WorkerThread worker = null;
         try {
             worker = _workers.ElementAt(i);
         } catch (Exception e) { }
         if (worker == null)
         {
             break;
         }
         if (worker.CurrentTaskProcessTime() > WorkerThreadTaskProcessTimeoutSeconds * 1000)
         {
             _log("Warning: worker thread is locked");
             _workers.Remove(worker);
             worker.Abort();
         }
     }
 }