aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
diff options
context:
space:
mode:
authorTedd Hansen2008-02-22 20:06:44 +0000
committerTedd Hansen2008-02-22 20:06:44 +0000
commite741dcde6ad081e630d7659be0995e70a66504a0 (patch)
tree24277c3e349794a143f0fd4bbbd86546a298eefc /OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
parentBetter timing of MaintenanceThread's tasks (uses less CPU) (diff)
downloadopensim-SC-e741dcde6ad081e630d7659be0995e70a66504a0.zip
opensim-SC-e741dcde6ad081e630d7659be0995e70a66504a0.tar.gz
opensim-SC-e741dcde6ad081e630d7659be0995e70a66504a0.tar.bz2
opensim-SC-e741dcde6ad081e630d7659be0995e70a66504a0.tar.xz
Some misplaced code made scripts never start :)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs27
1 files changed, 13 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
index c329246..47fe815 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
@@ -129,7 +129,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
129 129
130 long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks; 130 long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks;
131 long Last_ReReadConfigFilens = DateTime.Now.Ticks; 131 long Last_ReReadConfigFilens = DateTime.Now.Ticks;
132 long Last_MaintenanceRun = 0;
133 int MaintenanceLoopTicks_ScriptLoadUnload_Count = 0; 132 int MaintenanceLoopTicks_ScriptLoadUnload_Count = 0;
134 int MaintenanceLoopTicks_Other_Count = 0; 133 int MaintenanceLoopTicks_Other_Count = 0;
135 134
@@ -140,8 +139,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
140 while (true) 139 while (true)
141 { 140 {
142 System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass 141 System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass
143 //if (PleaseShutdown) 142
144 // return; 143 // Increase our counters
145 MaintenanceLoopTicks_ScriptLoadUnload_Count++; 144 MaintenanceLoopTicks_ScriptLoadUnload_Count++;
146 MaintenanceLoopTicks_Other_Count++; 145 MaintenanceLoopTicks_Other_Count++;
147 146
@@ -150,12 +149,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
150 { 149 {
151 lastScriptEngine = m_ScriptEngine; 150 lastScriptEngine = m_ScriptEngine;
152 // Re-reading config every x seconds 151 // Re-reading config every x seconds
153 if (m_ScriptEngine.RefreshConfigFilens > 0) 152 if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other)
154 { 153 {
155 154 MaintenanceLoopTicks_Other_Count = 0;
156 if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other) 155 if (m_ScriptEngine.RefreshConfigFilens > 0)
157 { 156 {
158 MaintenanceLoopTicks_Other_Count = 0; 157
159 // Check if its time to re-read config 158 // Check if its time to re-read config
160 if (DateTime.Now.Ticks - Last_ReReadConfigFilens > 159 if (DateTime.Now.Ticks - Last_ReReadConfigFilens >
161 m_ScriptEngine.RefreshConfigFilens) 160 m_ScriptEngine.RefreshConfigFilens)
@@ -185,13 +184,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
185 } 184 }
186 } 185 }
187 186
188 if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload) 187 }
189 { 188 if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload)
190 MaintenanceLoopTicks_ScriptLoadUnload_Count = 0; 189 {
191 // LOAD / UNLOAD SCRIPTS 190 MaintenanceLoopTicks_ScriptLoadUnload_Count = 0;
192 if (m_ScriptEngine.m_ScriptManager != null) 191 // LOAD / UNLOAD SCRIPTS
193 m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload(); 192 if (m_ScriptEngine.m_ScriptManager != null)
194 } 193 m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
195 } 194 }
196 } 195 }
197 } 196 }