diff options
author | Diva Canto | 2010-07-19 15:20:34 -0700 |
---|---|---|
committer | Diva Canto | 2010-07-19 15:20:34 -0700 |
commit | ffbae52a130376ecaa04d7d475709985c62c06ed (patch) | |
tree | 20abae9291e1c5c0efd7b00072aeaa156726ce29 /OpenSim/Region/ScriptEngine/XEngine | |
parent | One more stab at http://opensimulator.org/mantis/view.php?id=4858. (diff) | |
download | opensim-SC-ffbae52a130376ecaa04d7d475709985c62c06ed.zip opensim-SC-ffbae52a130376ecaa04d7d475709985c62c06ed.tar.gz opensim-SC-ffbae52a130376ecaa04d7d475709985c62c06ed.tar.bz2 opensim-SC-ffbae52a130376ecaa04d7d475709985c62c06ed.tar.xz |
Another stab at http://opensimulator.org/mantis/view.php?id=4858. Eliminated more nested locks.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index c436582..b050349 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -701,9 +701,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
701 | } | 701 | } |
702 | } | 702 | } |
703 | 703 | ||
704 | ScriptInstance instance = null; | ||
704 | lock (m_Scripts) | 705 | lock (m_Scripts) |
705 | { | 706 | { |
706 | ScriptInstance instance = null; | ||
707 | // Create the object record | 707 | // Create the object record |
708 | 708 | ||
709 | if ((!m_Scripts.ContainsKey(itemID)) || | 709 | if ((!m_Scripts.ContainsKey(itemID)) || |
@@ -786,28 +786,29 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
786 | 786 | ||
787 | m_Scripts[itemID] = instance; | 787 | m_Scripts[itemID] = instance; |
788 | } | 788 | } |
789 | } | ||
789 | 790 | ||
790 | lock (m_PrimObjects) | 791 | lock (m_PrimObjects) |
791 | { | 792 | { |
792 | if (!m_PrimObjects.ContainsKey(localID)) | 793 | if (!m_PrimObjects.ContainsKey(localID)) |
793 | m_PrimObjects[localID] = new List<UUID>(); | 794 | m_PrimObjects[localID] = new List<UUID>(); |
794 | 795 | ||
795 | if (!m_PrimObjects[localID].Contains(itemID)) | 796 | if (!m_PrimObjects[localID].Contains(itemID)) |
796 | m_PrimObjects[localID].Add(itemID); | 797 | m_PrimObjects[localID].Add(itemID); |
797 | 798 | ||
798 | } | 799 | } |
799 | 800 | ||
800 | if (!m_Assemblies.ContainsKey(assetID)) | 801 | if (!m_Assemblies.ContainsKey(assetID)) |
801 | m_Assemblies[assetID] = assembly; | 802 | m_Assemblies[assetID] = assembly; |
802 | 803 | ||
803 | lock (m_AddingAssemblies) | 804 | lock (m_AddingAssemblies) |
804 | { | 805 | { |
805 | m_AddingAssemblies[assembly]--; | 806 | m_AddingAssemblies[assembly]--; |
806 | } | ||
807 | |||
808 | if (instance!=null) | ||
809 | instance.Init(); | ||
810 | } | 807 | } |
808 | |||
809 | if (instance != null) | ||
810 | instance.Init(); | ||
811 | |||
811 | return true; | 812 | return true; |
812 | } | 813 | } |
813 | 814 | ||
@@ -1007,26 +1008,33 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1007 | public bool PostObjectEvent(uint localID, EventParams p) | 1008 | public bool PostObjectEvent(uint localID, EventParams p) |
1008 | { | 1009 | { |
1009 | bool result = false; | 1010 | bool result = false; |
1010 | 1011 | List<UUID> uuids = null; | |
1012 | |||
1011 | lock (m_PrimObjects) | 1013 | lock (m_PrimObjects) |
1012 | { | 1014 | { |
1013 | if (!m_PrimObjects.ContainsKey(localID)) | 1015 | if (!m_PrimObjects.ContainsKey(localID)) |
1014 | return false; | 1016 | return false; |
1015 | 1017 | ||
1016 | 1018 | uuids = m_PrimObjects[localID]; | |
1017 | foreach (UUID itemID in m_PrimObjects[localID]) | 1019 | } |
1020 | |||
1021 | foreach (UUID itemID in uuids) | ||
1022 | { | ||
1023 | IScriptInstance instance = null; | ||
1024 | try | ||
1018 | { | 1025 | { |
1019 | if (m_Scripts.ContainsKey(itemID)) | 1026 | if (m_Scripts.ContainsKey(itemID)) |
1020 | { | 1027 | instance = m_Scripts[itemID]; |
1021 | IScriptInstance instance = m_Scripts[itemID]; | 1028 | } |
1022 | if (instance != null) | 1029 | catch { /* ignore race conditions */ } |
1023 | { | 1030 | |
1024 | instance.PostEvent(p); | 1031 | if (instance != null) |
1025 | result = true; | 1032 | { |
1026 | } | 1033 | instance.PostEvent(p); |
1027 | } | 1034 | result = true; |
1028 | } | 1035 | } |
1029 | } | 1036 | } |
1037 | |||
1030 | return result; | 1038 | return result; |
1031 | } | 1039 | } |
1032 | 1040 | ||