Пример #1
0
 private void SafeRun()
 {
     try
     {
         while (!IsNeedStop)
         {
             var words = _queue.GetItem();
             if (words != null)
             {
                 foreach (var item in words.Items)
                 {
                     _totalResult.Add(item.Word, item.Count);
                 }
                 _count++;
                 if (_count >= _fileCount)
                 {
                     // сообщаем, что работа завершена
                     _stopEvent.Set();
                     _isNeedStop = true;
                 }
             }
             else
             {
                 WaitQueue();
             }
         }
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Произошла ошибка в Marger", ex);
     }
 }