aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2010-07-19 13:59:11 -0700
committerDiva Canto2010-07-19 13:59:11 -0700
commit5c0c7fda6c323cfbbe76562eda3fe0b767561dd1 (patch)
tree138ec8448371528db3107db9b5c2f689e0f98fc0 /OpenSim/Region
parentDeleted Snoopy's patch completely, including Thread.Sleep. Preliminary tests ... (diff)
downloadopensim-SC_OLD-5c0c7fda6c323cfbbe76562eda3fe0b767561dd1.zip
opensim-SC_OLD-5c0c7fda6c323cfbbe76562eda3fe0b767561dd1.tar.gz
opensim-SC_OLD-5c0c7fda6c323cfbbe76562eda3fe0b767561dd1.tar.bz2
opensim-SC_OLD-5c0c7fda6c323cfbbe76562eda3fe0b767561dd1.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/Region')
-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 0299385..c436582 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -820,60 +820,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine
820 m_CompileDict.Remove(itemID); 820 m_CompileDict.Remove(itemID);
821 } 821 }
822 822
823 IScriptInstance instance = null;
824
823 lock (m_Scripts) 825 lock (m_Scripts)
824 { 826 {
825 // Do we even have it? 827 // Do we even have it?
826 if (!m_Scripts.ContainsKey(itemID)) 828 if (!m_Scripts.ContainsKey(itemID))
827 return; 829 return;
828 830
829 IScriptInstance instance=m_Scripts[itemID]; 831 instance=m_Scripts[itemID];
830 m_Scripts.Remove(itemID); 832 m_Scripts.Remove(itemID);
833 }
831 834
832 instance.ClearQueue(); 835 instance.ClearQueue();
833 instance.Stop(0); 836 instance.Stop(0);
834
835// bool objectRemoved = false; 837// bool objectRemoved = false;
836 838
837 lock (m_PrimObjects) 839 lock (m_PrimObjects)
840 {
841 // Remove the script from it's prim
842 if (m_PrimObjects.ContainsKey(localID))
838 { 843 {
839 // Remove the script from it's prim 844 // Remove inventory item record
840 if (m_PrimObjects.ContainsKey(localID)) 845 if (m_PrimObjects[localID].Contains(itemID))
841 { 846 m_PrimObjects[localID].Remove(itemID);
842 // Remove inventory item record
843 if (m_PrimObjects[localID].Contains(itemID))
844 m_PrimObjects[localID].Remove(itemID);
845 847
846 // If there are no more scripts, remove prim 848 // If there are no more scripts, remove prim
847 if (m_PrimObjects[localID].Count == 0) 849 if (m_PrimObjects[localID].Count == 0)
848 { 850 {
849 m_PrimObjects.Remove(localID); 851 m_PrimObjects.Remove(localID);
850// objectRemoved = true; 852// objectRemoved = true;
851 }
852 } 853 }
853 } 854 }
855 }
854 856
855 instance.RemoveState(); 857 instance.RemoveState();
856 instance.DestroyScriptInstance(); 858 instance.DestroyScriptInstance();
857 859
858 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); 860 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
859 if (m_DomainScripts[instance.AppDomain].Count == 0) 861 if (m_DomainScripts[instance.AppDomain].Count == 0)
860 { 862 {
861 m_DomainScripts.Remove(instance.AppDomain); 863 m_DomainScripts.Remove(instance.AppDomain);
862 UnloadAppDomain(instance.AppDomain); 864 UnloadAppDomain(instance.AppDomain);
863 } 865 }
864
865 instance = null;
866 866
867 ObjectRemoved handlerObjectRemoved = OnObjectRemoved; 867 instance = null;
868 if (handlerObjectRemoved != null)
869 {
870 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
871 handlerObjectRemoved(part.UUID);
872 }
873 868
874 CleanAssemblies(); 869 ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
870 if (handlerObjectRemoved != null)
871 {
872 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
873 handlerObjectRemoved(part.UUID);
875 } 874 }
876 875
876
877 ScriptRemoved handlerScriptRemoved = OnScriptRemoved; 877 ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
878 if (handlerScriptRemoved != null) 878 if (handlerScriptRemoved != null)
879 handlerScriptRemoved(itemID); 879 handlerScriptRemoved(itemID);