diff options
author | Sean Dague | 2008-05-07 18:10:18 +0000 |
---|---|---|
committer | Sean Dague | 2008-05-07 18:10:18 +0000 |
commit | edd6577f84cb4714c8d1c0b156ffbddfe3b1f87e (patch) | |
tree | f60c038e6df6b67e38e73dbacff2090286446e40 | |
parent | *Fixed Missing SceneExternalChecks.cs (diff) | |
download | opensim-SC_OLD-edd6577f84cb4714c8d1c0b156ffbddfe3b1f87e.zip opensim-SC_OLD-edd6577f84cb4714c8d1c0b156ffbddfe3b1f87e.tar.gz opensim-SC_OLD-edd6577f84cb4714c8d1c0b156ffbddfe3b1f87e.tar.bz2 opensim-SC_OLD-edd6577f84cb4714c8d1c0b156ffbddfe3b1f87e.tar.xz |
while I'm not convinced this is causing my current run away
loop, this queue manipulation is dead wrong as Queue is not
a synchronized data structure. Hopefully this helps.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 7812c8c..f5de967 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -207,11 +207,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
207 | 207 | ||
208 | public void DoScriptLoadUnload() | 208 | public void DoScriptLoadUnload() |
209 | { | 209 | { |
210 | if (LUQueue.Count > 0) | 210 | lock (LUQueue) { |
211 | { | 211 | if (LUQueue.Count > 0) |
212 | LUStruct item = LUQueue.Dequeue(); | ||
213 | lock (startStopLock) // Lock so we have only 1 thread working on loading/unloading of scripts | ||
214 | { | 212 | { |
213 | LUStruct item = LUQueue.Dequeue(); | ||
214 | |||
215 | if (item.Action == LUType.Unload) | 215 | if (item.Action == LUType.Unload) |
216 | { | 216 | { |
217 | _StopScript(item.localID, item.itemID); | 217 | _StopScript(item.localID, item.itemID); |
@@ -222,9 +222,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
222 | } | 222 | } |
223 | } | 223 | } |
224 | } | 224 | } |
225 | |||
226 | } | 225 | } |
227 | 226 | ||
228 | #endregion | 227 | #endregion |
229 | 228 | ||
230 | #region Helper functions | 229 | #region Helper functions |
@@ -250,18 +249,20 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
250 | /// <param name="localID"></param> | 249 | /// <param name="localID"></param> |
251 | public void StartScript(uint localID, LLUUID itemID, string Script) | 250 | public void StartScript(uint localID, LLUUID itemID, string Script) |
252 | { | 251 | { |
253 | if (LUQueue.Count >= LoadUnloadMaxQueueSize) | 252 | lock(LUQueue) { |
254 | { | 253 | if (LUQueue.Count >= LoadUnloadMaxQueueSize) |
255 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: ERROR: Load/unload queue item count is at " + LUQueue.Count + ". Config variable \"LoadUnloadMaxQueueSize\" is set to " + LoadUnloadMaxQueueSize + ", so ignoring new script."); | 254 | { |
256 | return; | 255 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: ERROR: Load/unload queue item count is at " + LUQueue.Count + ". Config variable \"LoadUnloadMaxQueueSize\" is set to " + LoadUnloadMaxQueueSize + ", so ignoring new script."); |
257 | } | 256 | return; |
257 | } | ||
258 | 258 | ||
259 | LUStruct ls = new LUStruct(); | 259 | LUStruct ls = new LUStruct(); |
260 | ls.localID = localID; | 260 | ls.localID = localID; |
261 | ls.itemID = itemID; | 261 | ls.itemID = itemID; |
262 | ls.script = Script; | 262 | ls.script = Script; |
263 | ls.Action = LUType.Load; | 263 | ls.Action = LUType.Load; |
264 | LUQueue.Enqueue(ls); | 264 | LUQueue.Enqueue(ls); |
265 | } | ||
265 | } | 266 | } |
266 | 267 | ||
267 | /// <summary> | 268 | /// <summary> |
@@ -275,7 +276,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
275 | ls.localID = localID; | 276 | ls.localID = localID; |
276 | ls.itemID = itemID; | 277 | ls.itemID = itemID; |
277 | ls.Action = LUType.Unload; | 278 | ls.Action = LUType.Unload; |
278 | LUQueue.Enqueue(ls); | 279 | lock (LUQueue) { |
280 | LUQueue.Enqueue(ls); | ||
281 | } | ||
279 | } | 282 | } |
280 | 283 | ||
281 | // Create a new instance of the compiler (reuse) | 284 | // Create a new instance of the compiler (reuse) |