From 530cc2488461a4ef68a06eaba42698fcdc09f459 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 19 Feb 2008 19:16:21 +0000 Subject: From: Michael Osias This patch implements the llSendRemoteData command and fixes mantis 552, and possibly 586. --- .../Common/ScriptEngineBase/ScriptManager.cs | 56 ++++++++++++---------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs') diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 641453e..d47cab8 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs @@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase private Queue LUQueue = new Queue(); private static bool PrivateThread; private int LoadUnloadMaxQueueSize; + private Object scriptLock = new Object(); // Load/Unload structure private struct LUStruct @@ -304,7 +305,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase //ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID); IScript Script = GetScript(localID, itemID); if (Script == null) + { return; + } //cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined ///#if DEBUG /// Console.WriteLine("ScriptEngine: Executing event: " + FunctionName); @@ -331,37 +334,42 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public IScript GetScript(uint localID, LLUUID itemID) { - if (Scripts.ContainsKey(localID) == false) - return null; - - Dictionary Obj; - Scripts.TryGetValue(localID, out Obj); - if (Obj.ContainsKey(itemID) == false) - return null; - - // Get script - IScript Script; - Obj.TryGetValue(itemID, out Script); - - return Script; + lock (scriptLock) + { + if (Scripts.ContainsKey(localID) == false) + return null; + + Dictionary Obj; + Scripts.TryGetValue(localID, out Obj); + if (Obj.ContainsKey(itemID) == false) + return null; + + // Get script + IScript Script; + Obj.TryGetValue(itemID, out Script); + return Script; + } } public void SetScript(uint localID, LLUUID itemID, IScript Script) { - // Create object if it doesn't exist - if (Scripts.ContainsKey(localID) == false) + lock (scriptLock) { - Scripts.Add(localID, new Dictionary()); - } + // Create object if it doesn't exist + if (Scripts.ContainsKey(localID) == false) + { + Scripts.Add(localID, new Dictionary()); + } - // Delete script if it exists - Dictionary Obj; - Scripts.TryGetValue(localID, out Obj); - if (Obj.ContainsKey(itemID) == true) - Obj.Remove(itemID); + // Delete script if it exists + Dictionary Obj; + Scripts.TryGetValue(localID, out Obj); + if (Obj.ContainsKey(itemID) == true) + Obj.Remove(itemID); - // Add to object - Obj.Add(itemID, Script); + // Add to object + Obj.Add(itemID, Script); + } } public void RemoveScript(uint localID, LLUUID itemID) -- cgit v1.1