[All] Change threading to be global

This commit is contained in:
Matt Nadareski
2017-07-13 17:03:38 -07:00
parent b7b6247ef0
commit 181716fb41
12 changed files with 50 additions and 48 deletions

View File

@@ -18,6 +18,9 @@ namespace SabreTools.Library.Data
/// <param name="name">The name to be displayed as the program</param>B
public static void Start(string name)
{
// Set the maximum number of threads right off the bat
System.Threading.ThreadPool.SetMaxThreads(Globals.MaxThreads, Globals.MaxThreads);
// Dynamically create the header string, adapted from http://stackoverflow.com/questions/8200661/how-to-align-string-in-fixed-length-string
int width = Console.WindowWidth - 3;
string border = "+" + new string('-', width) + "+";

View File

@@ -36,9 +36,14 @@ namespace SabreTools.Library.Data
}
set { _logger = value; }
}
public static int MaxDegreeOfParallelism
public static int MaxThreads
{
set { _maxDegreeOfParallelism = value; }
get { return _maxDegreeOfParallelism; }
set
{
_maxDegreeOfParallelism = value;
System.Threading.ThreadPool.SetMaxThreads(_maxDegreeOfParallelism, _maxDegreeOfParallelism);
}
}
public static ParallelOptions ParallelOptions
{