mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Dont expose threads to old .NET
This commit is contained in:
@@ -763,7 +763,9 @@ CREATE TABLE IF NOT EXISTS dat (
|
||||
port = 65535;
|
||||
|
||||
// Finally set all of the fields
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
Globals.MaxThreads = workers;
|
||||
#endif
|
||||
_logdir = logdir;
|
||||
_tmpdir = tmpdir;
|
||||
_webdir = webdir;
|
||||
|
||||
@@ -16,12 +16,12 @@ namespace SabreTools.Core
|
||||
/// </summary>
|
||||
public readonly static string? Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
|
||||
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
/// <summary>
|
||||
/// Maximum threads to use during parallel operations
|
||||
/// </summary>
|
||||
public static int MaxThreads { get; set; } = Environment.ProcessorCount;
|
||||
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
/// <summary>
|
||||
/// ParallelOptions object for use in parallel operations
|
||||
/// </summary>
|
||||
|
||||
@@ -1150,6 +1150,7 @@ namespace SabreTools.Features
|
||||
}
|
||||
}
|
||||
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
internal const string ThreadsInt32Value = "threads";
|
||||
internal static Feature ThreadsInt32Input
|
||||
{
|
||||
@@ -1163,6 +1164,7 @@ namespace SabreTools.Features
|
||||
longDescription: "Optionally, set the number of threads to use for the multithreaded operations. The default is the number of available machine threads; -1 means unlimited threads created.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1812,7 +1814,9 @@ Some special strings that can be used:
|
||||
{
|
||||
AddFeature(ScriptFlag);
|
||||
AddFeature(LogLevelStringInput);
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
AddFeature(ThreadsInt32Input);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1886,8 +1890,10 @@ Some special strings that can be used:
|
||||
Splitter = GetSplitter(features);
|
||||
|
||||
// Set threading flag, if necessary
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
if (features.ContainsKey(ThreadsInt32Value))
|
||||
Globals.MaxThreads = GetInt32(features, ThreadsInt32Value);
|
||||
#endif
|
||||
|
||||
// Failure conditions
|
||||
if (Header == null)
|
||||
|
||||
Reference in New Issue
Block a user