Skip to content

Commit

Permalink
#299 Fix parallel range error, set the minimum value to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
doug24 committed Aug 18, 2018
1 parent 300acfc commit f5da70f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dnGREP.Engines/GrepCore.cs
Expand Up @@ -80,7 +80,7 @@ public List<GrepSearchResult> Search(IEnumerable<string> files, SearchType searc
cancellationTokenSource = new CancellationTokenSource();

ParallelOptions po = new ParallelOptions();
po.MaxDegreeOfParallelism = Environment.ProcessorCount * 4 / 5;
po.MaxDegreeOfParallelism = Math.Max(1, Environment.ProcessorCount * 4 / 5);
po.CancellationToken = cancellationTokenSource.Token;
Parallel.ForEach(files, po, f => Search(f, searchType, searchPattern, searchOptions, codePage));
}
Expand Down

0 comments on commit f5da70f

Please sign in to comment.