[Globals] Make parallel options easier to use

This commit is contained in:
Matt Nadareski
2017-03-14 20:28:23 -07:00
parent 2a70e9c381
commit ac14a3a1f4
5 changed files with 80 additions and 69 deletions

View File

@@ -39,7 +39,7 @@ namespace SabreTools.Helper.External
subdirs.Clear();
Parallel.ForEach(dirs,
new ParallelOptions() { MaxDegreeOfParallelism = Globals.MaxDegreeOfParallelism },
Globals.ParallelOptions,
currentDir =>
{
string[] subDirs = Directory.GetDirectories(currentDir);
@@ -57,7 +57,7 @@ namespace SabreTools.Helper.External
{
FileInfo[] files = dir.GetFiles("*.*", SearchOption.TopDirectoryOnly);
Parallel.ForEach(files,
new ParallelOptions() { MaxDegreeOfParallelism = Globals.MaxDegreeOfParallelism },
Globals.ParallelOptions,
info =>
{
action(info);