mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-11 19:12:31 +02:00
v2.20.5
- (Add) Setting - Max degree of parallelism: Sets the maximum number of concurrent tasks/threads/operations enabled to run by parallel method calls. If your computer lags and freeze during operations you can reduce this number to reduce the workload and keep some cores available to other tasks as well. <= 0: Will utilize however many threads the underlying scheduler provides, mostly this is the processor count. 1: Single thread. (#279)
This commit is contained in:
@@ -13,6 +13,7 @@ using System.Threading.Tasks;
|
||||
using UVtools.Core.Scripting;
|
||||
using Emgu.CV;
|
||||
using Emgu.CV.CvEnum;
|
||||
using UVtools.Core;
|
||||
|
||||
namespace UVtools.ScriptSample
|
||||
{
|
||||
@@ -90,7 +91,7 @@ namespace UVtools.ScriptSample
|
||||
Progress.Reset("Inset layers", Operation.LayerRangeCount); // Sets the progress name and number of items to process
|
||||
|
||||
// Loop user selected layers in parallel, this will put each core of CPU working here on parallel
|
||||
Parallel.For(Operation.LayerIndexStart, Operation.LayerIndexEnd+1, layerIndex =>
|
||||
Parallel.For(Operation.LayerIndexStart, Operation.LayerIndexEnd+1, CoreSettings.ParallelOptions, layerIndex =>
|
||||
{
|
||||
if (Progress.Token.IsCancellationRequested) return; // Abort operation, user requested cancellation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user