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;
|
port = 65535;
|
||||||
|
|
||||||
// Finally set all of the fields
|
// Finally set all of the fields
|
||||||
|
#if NET452_OR_GREATER || NETCOREAPP
|
||||||
Globals.MaxThreads = workers;
|
Globals.MaxThreads = workers;
|
||||||
|
#endif
|
||||||
_logdir = logdir;
|
_logdir = logdir;
|
||||||
_tmpdir = tmpdir;
|
_tmpdir = tmpdir;
|
||||||
_webdir = webdir;
|
_webdir = webdir;
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ namespace SabreTools.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly static string? Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
|
public readonly static string? Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
|
||||||
|
|
||||||
|
#if NET452_OR_GREATER || NETCOREAPP
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum threads to use during parallel operations
|
/// Maximum threads to use during parallel operations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int MaxThreads { get; set; } = Environment.ProcessorCount;
|
public static int MaxThreads { get; set; } = Environment.ProcessorCount;
|
||||||
|
|
||||||
#if NET452_OR_GREATER || NETCOREAPP
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ParallelOptions object for use in parallel operations
|
/// ParallelOptions object for use in parallel operations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1150,6 +1150,7 @@ namespace SabreTools.Features
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if NET452_OR_GREATER || NETCOREAPP
|
||||||
internal const string ThreadsInt32Value = "threads";
|
internal const string ThreadsInt32Value = "threads";
|
||||||
internal static Feature ThreadsInt32Input
|
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.");
|
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
|
#endregion
|
||||||
|
|
||||||
@@ -1812,7 +1814,9 @@ Some special strings that can be used:
|
|||||||
{
|
{
|
||||||
AddFeature(ScriptFlag);
|
AddFeature(ScriptFlag);
|
||||||
AddFeature(LogLevelStringInput);
|
AddFeature(LogLevelStringInput);
|
||||||
|
#if NET452_OR_GREATER || NETCOREAPP
|
||||||
AddFeature(ThreadsInt32Input);
|
AddFeature(ThreadsInt32Input);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1886,8 +1890,10 @@ Some special strings that can be used:
|
|||||||
Splitter = GetSplitter(features);
|
Splitter = GetSplitter(features);
|
||||||
|
|
||||||
// Set threading flag, if necessary
|
// Set threading flag, if necessary
|
||||||
|
#if NET452_OR_GREATER || NETCOREAPP
|
||||||
if (features.ContainsKey(ThreadsInt32Value))
|
if (features.ContainsKey(ThreadsInt32Value))
|
||||||
Globals.MaxThreads = GetInt32(features, ThreadsInt32Value);
|
Globals.MaxThreads = GetInt32(features, ThreadsInt32Value);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Failure conditions
|
// Failure conditions
|
||||||
if (Header == null)
|
if (Header == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user