Files
SabreTools/SabreTools.Core/Globals.cs
2024-03-05 03:04:47 -05:00

33 lines
776 B
C#

using System;
#if NET452_OR_GREATER || NETCOREAPP
using System.Threading.Tasks;
#endif
namespace SabreTools.Core
{
/// <summary>
/// Globally-accessible objects for the library
/// </summary>
public class Globals
{
#region Public accessors
/// <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>
public static ParallelOptions ParallelOptions => new()
{
MaxDegreeOfParallelism = MaxThreads
};
#endif
#endregion
}
}