From c0d9ab941dd1ab88f00f6d4f2a53a4fe5c605e57 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 19 Jul 2010 16:22:29 -0700 Subject: Reverting this for now, but this needs to go in again. Revert "Another stab at http://opensimulator.org/mantis/view.php?id=4858. Eliminated more nested locks." This reverts commit ffbae52a130376ecaa04d7d475709985c62c06ed. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 64 +++++++++++--------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index b050349..c436582 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -701,9 +701,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine } } - ScriptInstance instance = null; lock (m_Scripts) { + ScriptInstance instance = null; // Create the object record if ((!m_Scripts.ContainsKey(itemID)) || @@ -786,29 +786,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_Scripts[itemID] = instance; } - } - lock (m_PrimObjects) - { - if (!m_PrimObjects.ContainsKey(localID)) - m_PrimObjects[localID] = new List(); + lock (m_PrimObjects) + { + if (!m_PrimObjects.ContainsKey(localID)) + m_PrimObjects[localID] = new List(); - if (!m_PrimObjects[localID].Contains(itemID)) - m_PrimObjects[localID].Add(itemID); + if (!m_PrimObjects[localID].Contains(itemID)) + m_PrimObjects[localID].Add(itemID); - } + } - if (!m_Assemblies.ContainsKey(assetID)) - m_Assemblies[assetID] = assembly; + if (!m_Assemblies.ContainsKey(assetID)) + m_Assemblies[assetID] = assembly; - lock (m_AddingAssemblies) - { - m_AddingAssemblies[assembly]--; - } - - if (instance != null) - instance.Init(); + lock (m_AddingAssemblies) + { + m_AddingAssemblies[assembly]--; + } + if (instance!=null) + instance.Init(); + } return true; } @@ -1008,33 +1007,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine public bool PostObjectEvent(uint localID, EventParams p) { bool result = false; - List uuids = null; - + lock (m_PrimObjects) { if (!m_PrimObjects.ContainsKey(localID)) return false; - uuids = m_PrimObjects[localID]; - } - - foreach (UUID itemID in uuids) - { - IScriptInstance instance = null; - try + + foreach (UUID itemID in m_PrimObjects[localID]) { if (m_Scripts.ContainsKey(itemID)) - instance = m_Scripts[itemID]; - } - catch { /* ignore race conditions */ } - - if (instance != null) - { - instance.PostEvent(p); - result = true; + { + IScriptInstance instance = m_Scripts[itemID]; + if (instance != null) + { + instance.PostEvent(p); + result = true; + } + } } } - return result; } -- cgit v1.1