diff options
author | Diva Canto | 2010-07-19 15:20:34 -0700 |
---|---|---|
committer | Diva Canto | 2010-07-20 13:26:25 -0700 |
commit | 257a46dfb9d722de1e1bcf331c2def0549fb998e (patch) | |
tree | 236c4c9020837805c51d84920d8945c400e88cfd /OpenSim/Region/ScriptEngine/XEngine | |
parent | One more stab at http://opensimulator.org/mantis/view.php?id=4858. (diff) | |
download | opensim-SC_OLD-257a46dfb9d722de1e1bcf331c2def0549fb998e.zip opensim-SC_OLD-257a46dfb9d722de1e1bcf331c2def0549fb998e.tar.gz opensim-SC_OLD-257a46dfb9d722de1e1bcf331c2def0549fb998e.tar.bz2 opensim-SC_OLD-257a46dfb9d722de1e1bcf331c2def0549fb998e.tar.xz |
Another stab at http://opensimulator.org/mantis/view.php?id=4858. Eliminated more nested locks.
Diffstat (limited to '')
-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 b8bdc19..aff4bda 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)) || |
@@ -784,28 +784,29 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
784 | 784 | ||
785 | m_Scripts[itemID] = instance; | 785 | m_Scripts[itemID] = instance; |
786 | } | 786 | } |
787 | } | ||
787 | 788 | ||
788 | lock (m_PrimObjects) | 789 | lock (m_PrimObjects) |
789 | { | 790 | { |
790 | if (!m_PrimObjects.ContainsKey(localID)) | 791 | if (!m_PrimObjects.ContainsKey(localID)) |
791 | m_PrimObjects[localID] = new List<UUID>(); | 792 | m_PrimObjects[localID] = new List<UUID>(); |
792 | 793 | ||
793 | if (!m_PrimObjects[localID].Contains(itemID)) | 794 | if (!m_PrimObjects[localID].Contains(itemID)) |
794 | m_PrimObjects[localID].Add(itemID); | 795 | m_PrimObjects[localID].Add(itemID); |
795 | 796 | ||
796 | } | 797 | } |
797 | 798 | ||
798 | if (!m_Assemblies.ContainsKey(assetID)) | 799 | if (!m_Assemblies.ContainsKey(assetID)) |
799 | m_Assemblies[assetID] = assembly; | 800 | m_Assemblies[assetID] = assembly; |
800 | 801 | ||
801 | lock (m_AddingAssemblies) | 802 | lock (m_AddingAssemblies) |
802 | { | 803 | { |
803 | m_AddingAssemblies[assembly]--; | 804 | m_AddingAssemblies[assembly]--; |
804 | } | ||
805 | |||
806 | if (instance!=null) | ||
807 | instance.Init(); | ||
808 | } | 805 | } |
806 | |||
807 | if (instance != null) | ||
808 | instance.Init(); | ||
809 | |||
809 | return true; | 810 | return true; |
810 | } | 811 | } |
811 | 812 | ||
@@ -1005,26 +1006,33 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1005 | public bool PostObjectEvent(uint localID, EventParams p) | 1006 | public bool PostObjectEvent(uint localID, EventParams p) |
1006 | { | 1007 | { |
1007 | bool result = false; | 1008 | bool result = false; |
1008 | 1009 | List<UUID> uuids = null; | |
1010 | |||
1009 | lock (m_PrimObjects) | 1011 | lock (m_PrimObjects) |
1010 | { | 1012 | { |
1011 | if (!m_PrimObjects.ContainsKey(localID)) | 1013 | if (!m_PrimObjects.ContainsKey(localID)) |
1012 | return false; | 1014 | return false; |
1013 | 1015 | ||
1014 | 1016 | uuids = m_PrimObjects[localID]; | |
1015 | foreach (UUID itemID in m_PrimObjects[localID]) | 1017 | } |
1018 | |||
1019 | foreach (UUID itemID in uuids) | ||
1020 | { | ||
1021 | IScriptInstance instance = null; | ||
1022 | try | ||
1016 | { | 1023 | { |
1017 | if (m_Scripts.ContainsKey(itemID)) | 1024 | if (m_Scripts.ContainsKey(itemID)) |
1018 | { | 1025 | instance = m_Scripts[itemID]; |
1019 | IScriptInstance instance = m_Scripts[itemID]; | 1026 | } |
1020 | if (instance != null) | 1027 | catch { /* ignore race conditions */ } |
1021 | { | 1028 | |
1022 | instance.PostEvent(p); | 1029 | if (instance != null) |
1023 | result = true; | 1030 | { |
1024 | } | 1031 | instance.PostEvent(p); |
1025 | } | 1032 | result = true; |
1026 | } | 1033 | } |
1027 | } | 1034 | } |
1035 | |||
1028 | return result; | 1036 | return result; |
1029 | } | 1037 | } |
1030 | 1038 | ||