private void ThreadEntry() { bool keepGoing = true; FilePath currentFile = null; while (keepGoing) { try { if (this.files.IsEmpty) { keepGoing = false; this.log.Information( Verbosity.Diagnostic, $"{threadNumber}> Done processing" ); continue; } if (this.files.TryDequeue(out currentFile)) { Verbosity startVerbosity = this.settings.DryRun ? Verbosity.Quiet : Verbosity.Minimal; if (settings.FileFilter(currentFile)) { this.log.Information( startVerbosity, $"{threadNumber}> Begin Processing '{currentFile}'..." ); this.processor.ProcessFile(currentFile); this.log.Information( Verbosity.Diagnostic, $"{threadNumber}> Finished Processing '{currentFile}'." ); } else { this.log.Information( Verbosity.Verbose, $"{threadNumber}> Skipping '{currentFile}'." ); } } else { this.log.Warning( Verbosity.Verbose, $"{threadNumber}> Could not dequeue from queue, trying again." ); Thread.Sleep(100); } } catch (ThreadAbortException) { throw; } catch (Exception e) { this.log.Error( Verbosity.Minimal, $"{threadNumber}> Error when processing {currentFile ?? "[null]"}: {e.Message}" ); if (currentFile != null) { this.result.Exceptions.Add(currentFile, e); } } } this.log.Information( Verbosity.Diagnostic, $"{threadNumber}> Thread Exiting" ); }