- (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:
Tiago Conceição
2021-08-31 17:06:46 +01:00
parent 1fd53c9d3c
commit 774fe9d5d0
59 changed files with 302 additions and 129 deletions
+2 -1
View File
@@ -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