diff --git a/src/ImageSharp/Advanced/ParallelExecutionSettings.cs b/src/ImageSharp/Advanced/ParallelExecutionSettings.cs index ad0318297a..cf86d094df 100644 --- a/src/ImageSharp/Advanced/ParallelExecutionSettings.cs +++ b/src/ImageSharp/Advanced/ParallelExecutionSettings.cs @@ -20,7 +20,7 @@ public readonly struct ParallelExecutionSettings /// /// /// The value used for initializing when using TPL. - /// Set to -1 to leave the degree of parallelism unbounded. + /// If set to -1, there is no limit on the number of concurrently running operations. /// /// The value for . /// The . @@ -31,7 +31,7 @@ public readonly struct ParallelExecutionSettings { // Shall be compatible with ParallelOptions.MaxDegreeOfParallelism: // https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.paralleloptions.maxdegreeofparallelism - if (maxDegreeOfParallelism == 0 || maxDegreeOfParallelism < -1) + if (maxDegreeOfParallelism is 0 or < -1) { throw new ArgumentOutOfRangeException(nameof(maxDegreeOfParallelism)); } @@ -49,7 +49,7 @@ public readonly struct ParallelExecutionSettings /// /// /// The value used for initializing when using TPL. - /// Set to -1 to leave the degree of parallelism unbounded. + /// If set to -1, there is no limit on the number of concurrently running operations. /// /// The . public ParallelExecutionSettings(int maxDegreeOfParallelism, MemoryAllocator memoryAllocator) @@ -64,7 +64,7 @@ public readonly struct ParallelExecutionSettings /// /// Gets the value used for initializing when using TPL. - /// A value of -1 leaves the degree of parallelism unbounded. + /// A value of -1 means there is no limit on the number of concurrently running operations. /// public int MaxDegreeOfParallelism { get; } @@ -93,12 +93,10 @@ public readonly struct ParallelExecutionSettings } /// - /// Get the default for a + /// Get the default for a /// /// The . /// The . public static ParallelExecutionSettings FromConfiguration(Configuration configuration) - { - return new ParallelExecutionSettings(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator); - } + => new(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator); } diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs index 2673927231..ae6fd96612 100644 --- a/src/ImageSharp/Configuration.cs +++ b/src/ImageSharp/Configuration.cs @@ -64,8 +64,9 @@ public sealed class Configuration /// /// Gets or sets the maximum number of concurrent tasks enabled in ImageSharp algorithms /// configured with this instance. - /// Set to -1 to leave the degree of parallelism unbounded. - /// Initialized with by default. + /// A positive value limits the number of concurrent operations to the set value. + /// If set to -1, there is no limit on the number of concurrently running operations. + /// Defaults to . /// public int MaxDegreeOfParallelism {