aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTedd Hansen2008-02-22 13:23:45 +0000
committerTedd Hansen2008-02-22 13:23:45 +0000
commit3bb0fe098fc721a4d5059c0505c4d31165451f9f (patch)
tree0188aeda26c4efac35bace3400fad1a8d5e57d5d /OpenSim
parentNow last commit will compile too... The features just keep on coming! (diff)
downloadopensim-SC_OLD-3bb0fe098fc721a4d5059c0505c4d31165451f9f.zip
opensim-SC_OLD-3bb0fe098fc721a4d5059c0505c4d31165451f9f.tar.gz
opensim-SC_OLD-3bb0fe098fc721a4d5059c0505c4d31165451f9f.tar.bz2
opensim-SC_OLD-3bb0fe098fc721a4d5059c0505c4d31165451f9f.tar.xz
Maintenance thread in charge of loading/unloading of scripts. 1 thread less per region.
Total so far: 2 threads less per region Note: Currently causes delay in load/unload of scripts
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs40
2 files changed, 28 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
index 14f7c4f..5c9f76d 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
@@ -168,6 +168,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
168 Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time 168 Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
169 } 169 }
170 } 170 }
171
172 // LOAD / UNLOAD SCRIPTS
173 if (m_ScriptEngine.m_ScriptManager != null)
174 m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
175
171 } 176 }
172 } 177 }
173 } 178 }
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
index 20ff07a..7939219 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
@@ -129,14 +129,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
129 if (PrivateThread) 129 if (PrivateThread)
130 { 130 {
131 // Assign one thread per region 131 // Assign one thread per region
132 scriptLoadUnloadThread = StartScriptLoadUnloadThread(); 132 //scriptLoadUnloadThread = StartScriptLoadUnloadThread();
133 } 133 }
134 else 134 else
135 { 135 {
136 // Shared thread - make sure one exist, then assign it to the private 136 // Shared thread - make sure one exist, then assign it to the private
137 if (staticScriptLoadUnloadThread == null) 137 if (staticScriptLoadUnloadThread == null)
138 { 138 {
139 staticScriptLoadUnloadThread = StartScriptLoadUnloadThread(); 139 //staticScriptLoadUnloadThread = StartScriptLoadUnloadThread();
140 } 140 }
141 scriptLoadUnloadThread = staticScriptLoadUnloadThread; 141 scriptLoadUnloadThread = staticScriptLoadUnloadThread;
142 } 142 }
@@ -196,21 +196,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
196 Thread.Sleep(scriptLoadUnloadThread_IdleSleepms); 196 Thread.Sleep(scriptLoadUnloadThread_IdleSleepms);
197 //if (PleaseShutdown) 197 //if (PleaseShutdown)
198 // return; 198 // return;
199 if (LUQueue.Count > 0) 199 DoScriptLoadUnload();
200 {
201 LUStruct item = LUQueue.Dequeue();
202 lock (startStopLock) // Lock so we have only 1 thread working on loading/unloading of scripts
203 {
204 if (item.Action == LUType.Unload)
205 {
206 _StopScript(item.localID, item.itemID);
207 }
208 if (item.Action == LUType.Load)
209 {
210 _StartScript(item.localID, item.itemID, item.script);
211 }
212 }
213 }
214 } 200 }
215 } 201 }
216 catch (ThreadAbortException tae) 202 catch (ThreadAbortException tae)
@@ -221,6 +207,26 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
221 } 207 }
222 } 208 }
223 209
210 public void DoScriptLoadUnload()
211 {
212 if (LUQueue.Count > 0)
213 {
214 LUStruct item = LUQueue.Dequeue();
215 lock (startStopLock) // Lock so we have only 1 thread working on loading/unloading of scripts
216 {
217 if (item.Action == LUType.Unload)
218 {
219 _StopScript(item.localID, item.itemID);
220 }
221 if (item.Action == LUType.Load)
222 {
223 _StartScript(item.localID, item.itemID, item.script);
224 }
225 }
226 }
227
228 }
229
224 #endregion 230 #endregion
225 231
226 #region Helper functions 232 #region Helper functions