aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-07-19 13:59:11 -0700
committerDiva Canto2010-07-20 13:26:08 -0700
commit699d3b0965a5e77c967365dec41813fe9e196836 (patch)
tree9f32b4fc0664825508b60e4ec208f89eaf96b86c /OpenSim
parentDeleted Snoopy's patch completely, including Thread.Sleep. Preliminary tests ... (diff)
downloadopensim-SC_OLD-699d3b0965a5e77c967365dec41813fe9e196836.zip
opensim-SC_OLD-699d3b0965a5e77c967365dec41813fe9e196836.tar.gz
opensim-SC_OLD-699d3b0965a5e77c967365dec41813fe9e196836.tar.bz2
opensim-SC_OLD-699d3b0965a5e77c967365dec41813fe9e196836.tar.xz
One more stab at http://opensimulator.org/mantis/view.php?id=4858.
Eliminated the nested locks of m_Scripts and m_PrimObjects.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs66
1 files changed, 33 insertions, 33 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 808cf82..b8bdc19 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -818,60 +818,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine
818 m_CompileDict.Remove(itemID); 818 m_CompileDict.Remove(itemID);
819 } 819 }
820 820
821 IScriptInstance instance = null;
822
821 lock (m_Scripts) 823 lock (m_Scripts)
822 { 824 {
823 // Do we even have it? 825 // Do we even have it?
824 if (!m_Scripts.ContainsKey(itemID)) 826 if (!m_Scripts.ContainsKey(itemID))
825 return; 827 return;
826 828
827 IScriptInstance instance=m_Scripts[itemID]; 829 instance=m_Scripts[itemID];
828 m_Scripts.Remove(itemID); 830 m_Scripts.Remove(itemID);
831 }
829 832
830 instance.ClearQueue(); 833 instance.ClearQueue();
831 instance.Stop(0); 834 instance.Stop(0);
832
833// bool objectRemoved = false; 835// bool objectRemoved = false;
834 836
835 lock (m_PrimObjects) 837 lock (m_PrimObjects)
838 {
839 // Remove the script from it's prim
840 if (m_PrimObjects.ContainsKey(localID))
836 { 841 {
837 // Remove the script from it's prim 842 // Remove inventory item record
838 if (m_PrimObjects.ContainsKey(localID)) 843 if (m_PrimObjects[localID].Contains(itemID))
839 { 844 m_PrimObjects[localID].Remove(itemID);
840 // Remove inventory item record
841 if (m_PrimObjects[localID].Contains(itemID))
842 m_PrimObjects[localID].Remove(itemID);
843 845
844 // If there are no more scripts, remove prim 846 // If there are no more scripts, remove prim
845 if (m_PrimObjects[localID].Count == 0) 847 if (m_PrimObjects[localID].Count == 0)
846 { 848 {
847 m_PrimObjects.Remove(localID); 849 m_PrimObjects.Remove(localID);
848// objectRemoved = true; 850// objectRemoved = true;
849 }
850 } 851 }
851 } 852 }
853 }
852 854
853 instance.RemoveState(); 855 instance.RemoveState();
854 instance.DestroyScriptInstance(); 856 instance.DestroyScriptInstance();
855 857
856 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); 858 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
857 if (m_DomainScripts[instance.AppDomain].Count == 0) 859 if (m_DomainScripts[instance.AppDomain].Count == 0)
858 { 860 {
859 m_DomainScripts.Remove(instance.AppDomain); 861 m_DomainScripts.Remove(instance.AppDomain);
860 UnloadAppDomain(instance.AppDomain); 862 UnloadAppDomain(instance.AppDomain);
861 } 863 }
862
863 instance = null;
864 864
865 ObjectRemoved handlerObjectRemoved = OnObjectRemoved; 865 instance = null;
866 if (handlerObjectRemoved != null)
867 {
868 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
869 handlerObjectRemoved(part.UUID);
870 }
871 866
872 CleanAssemblies(); 867 ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
868 if (handlerObjectRemoved != null)
869 {
870 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
871 handlerObjectRemoved(part.UUID);
873 } 872 }
874 873
874
875 ScriptRemoved handlerScriptRemoved = OnScriptRemoved; 875 ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
876 if (handlerScriptRemoved != null) 876 if (handlerScriptRemoved != null)
877 handlerScriptRemoved(itemID); 877 handlerScriptRemoved(itemID);