aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs6
2 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs
index d2b4ebd..5dcaa8f 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs
@@ -207,8 +207,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
207 if(!m_Enabled) 207 if(!m_Enabled)
208 return; 208 return;
209 209
210 numThreadScriptWorkers = m_Config.GetInt("NumThreadScriptWorkers", 1); 210 numThreadScriptWorkers = m_Config.GetInt("NumThreadScriptWorkers", 2);
211 211 string priority = m_Config.GetString("Priority", "Normal");
212 m_TraceCalls = m_Config.GetBoolean("TraceCalls", false); 212 m_TraceCalls = m_Config.GetBoolean("TraceCalls", false);
213 m_Verbose = m_Config.GetBoolean("Verbose", false); 213 m_Verbose = m_Config.GetBoolean("Verbose", false);
214 m_ScriptDebug = m_Config.GetBoolean("ScriptDebug", false); 214 m_ScriptDebug = m_Config.GetBoolean("ScriptDebug", false);
@@ -250,9 +250,31 @@ namespace OpenSim.Region.ScriptEngine.Yengine
250 return; 250 return;
251 } 251 }
252 252
253 ThreadPriority workersPrio = ThreadPriority.Normal;
254 switch (priority)
255 {
256 case "Lowest":
257 workersPrio = ThreadPriority.Lowest;
258 break;
259 case "BelowNormal":
260 workersPrio = ThreadPriority.BelowNormal;
261 break;
262 case "Normal":
263 workersPrio = ThreadPriority.Normal;
264 break;
265 case "AboveNormal":
266 workersPrio = ThreadPriority.AboveNormal;
267 break;
268 case "Highest":
269 workersPrio = ThreadPriority.Highest;
270 break;
271 default:
272 m_log.ErrorFormat("[YEngine] Invalid thread priority: '{0}'. Assuming Normal", priority);
273 break;
274 }
253 m_SleepThread = StartMyThread(RunSleepThread, "Yengine sleep", ThreadPriority.Normal); 275 m_SleepThread = StartMyThread(RunSleepThread, "Yengine sleep", ThreadPriority.Normal);
254 for(int i = 0; i < numThreadScriptWorkers; i++) 276 for(int i = 0; i < numThreadScriptWorkers; i++)
255 StartThreadWorker(i); 277 StartThreadWorker(i, workersPrio);
256 278
257 m_log.InfoFormat("[YEngine]: Enabled, {0}.{1} Meg (0x{2}) stacks", 279 m_log.InfoFormat("[YEngine]: Enabled, {0}.{1} Meg (0x{2}) stacks",
258 (m_StackSize >> 20).ToString(), 280 (m_StackSize >> 20).ToString(),
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs
index f68fd51..c71eb81 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMRScriptThread.cs
@@ -56,13 +56,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine
56 } 56 }
57 } 57 }
58 58
59 public void StartThreadWorker(int i) 59 public void StartThreadWorker(int i, ThreadPriority priority)
60 { 60 {
61 Thread thd; 61 Thread thd;
62 if(i >= 0) 62 if(i >= 0)
63 thd = Yengine.StartMyThread(RunScriptThread, "YScript" + i.ToString(), ThreadPriority.BelowNormal); 63 thd = Yengine.StartMyThread(RunScriptThread, "YScript" + i.ToString(), priority);
64 else 64 else
65 thd = Yengine.StartMyThread(RunScriptThread, "YScript", ThreadPriority.BelowNormal); 65 thd = Yengine.StartMyThread(RunScriptThread, "YScript", priority);
66 lock(m_WakeUpLock) 66 lock(m_WakeUpLock)
67 m_RunningInstances.Add(thd.ManagedThreadId, null); 67 m_RunningInstances.Add(thd.ManagedThreadId, null);
68 } 68 }