Changeset - c9ad5ae6640a
[Not reviewed]
default
0 2 0
Jason Maltzen (jmaltzen) - 8 years ago 2016-01-15 17:25:49
jason.maltzen@unsanctioned.net
Add a thread count for paint recipe generation to settings
2 files changed with 9 insertions and 1 deletions:
0 comments (0 inline, 0 general)
RecipeGenerator.cs
Show inline comments
...
 
@@ -70,6 +70,8 @@ namespace DesertPaintLab
 
        public uint FullQuantityDepth { get; private set; } // at or equal this number of reagents, ignore ingredient settings for max quantity
 
        public uint FullQuantity { get; private set; }  // The max number of a reagent to use at full quantity
 

	
 
        public uint MaxThreads { get; set; }
 

	
 
        ReactionSet reactions;
 
        bool running = false;
 

	
...
 
@@ -270,7 +272,7 @@ namespace DesertPaintLab
 
            }
 
            runningThreads = 0; // presumably!
 

	
 
            int threadCount = Math.Min(costSortedReagents.Count, searchQueue.Count);
 
            int threadCount = Math.Min(Math.Min(costSortedReagents.Count, searchQueue.Count), (int)MaxThreads);
 
            if (threadCount == 0)
 
            {
 
                if (Finished != null)
...
 
@@ -279,9 +281,11 @@ namespace DesertPaintLab
 
                }
 
            }
 
            generatorThreads.Clear();
 
            System.Console.WriteLine("Starting {0} generator threads.", threadCount);
 
            for (int i = 0; i < threadCount; ++i)
 
            {
 
                Thread thr = new Thread(new ThreadStart(this.Generate));
 
                thr.Priority = ThreadPriority.BelowNormal;
 
                generatorThreads.Add(thr);
 
            }
 
            foreach (Thread thr in generatorThreads)
RecipeGeneratorWindow.cs
Show inline comments
...
 
@@ -116,6 +116,10 @@ namespace DesertPaintLab
 
            pauseForCheckpoint = false;
 

	
 
            generator = new RecipeGenerator(profile.Reactions);
 
            int threads;
 
            DesertPaintLab.Settings.Get("GeneratorThreads", out threads);
 
            if (threads <= 0) { threads = 15; }
 
            generator.MaxThreads = (uint)threads;
 
            generator.InitRecipes(profile.Recipes);
 

	
 
            generator.Progress += OnProgress;
0 comments (0 inline, 0 general)