aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-17 21:03:08 +0000
committerJustin Clark-Casey (justincc)2011-11-17 21:03:08 +0000
commitcacc02883526d6913be13d745215d7367708412e (patch)
treedd06d0f6f8a296f6274c9f946ad7a3f108cfa73d /OpenSim/Region/ScriptEngine/XEngine
parentStop OdePrim and OdeCharacter insanely overriding set LocalID to set their ow... (diff)
downloadopensim-SC_OLD-cacc02883526d6913be13d745215d7367708412e.zip
opensim-SC_OLD-cacc02883526d6913be13d745215d7367708412e.tar.gz
opensim-SC_OLD-cacc02883526d6913be13d745215d7367708412e.tar.bz2
opensim-SC_OLD-cacc02883526d6913be13d745215d7367708412e.tar.xz
If the entire simulator is shutting down then don't bother to unload the scripts from the appdomain in XEngine.
All the other actions (script state save, etc.) still occur. This makes shutdown where there are many scripts vastly quicker.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs26
1 files changed, 19 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 1c16c87..12e1a78 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -90,6 +90,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
90 private bool m_KillTimedOutScripts; 90 private bool m_KillTimedOutScripts;
91 private string m_ScriptEnginesPath = null; 91 private string m_ScriptEnginesPath = null;
92 92
93 /// <summary>
94 /// Is the entire simulator in the process of shutting down?
95 /// </summary>
96 private bool m_SimulatorShuttingDown;
97
93 private static List<XEngine> m_ScriptEngines = 98 private static List<XEngine> m_ScriptEngines =
94 new List<XEngine>(); 99 new List<XEngine>();
95 100
@@ -470,17 +475,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine
470 // 475 //
471 instance.DestroyScriptInstance(); 476 instance.DestroyScriptInstance();
472 477
473 // Unload scripts and app domains 478 // Unload scripts and app domains.
474 // Must be done explicitly because they have infinite 479 // Must be done explicitly because they have infinite
475 // lifetime 480 // lifetime.
476 // 481 // However, don't bother to do this if the simulator is shutting
477 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); 482 // down since it takes a long time with many scripts.
478 if (m_DomainScripts[instance.AppDomain].Count == 0) 483 if (!m_SimulatorShuttingDown)
479 { 484 {
480 m_DomainScripts.Remove(instance.AppDomain); 485 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
481 UnloadAppDomain(instance.AppDomain); 486 if (m_DomainScripts[instance.AppDomain].Count == 0)
487 {
488 m_DomainScripts.Remove(instance.AppDomain);
489 UnloadAppDomain(instance.AppDomain);
490 }
482 } 491 }
483 } 492 }
493
484 m_Scripts.Clear(); 494 m_Scripts.Clear();
485 m_PrimObjects.Clear(); 495 m_PrimObjects.Clear();
486 m_Assemblies.Clear(); 496 m_Assemblies.Clear();
@@ -1428,6 +1438,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1428 1438
1429 public void OnShutdown() 1439 public void OnShutdown()
1430 { 1440 {
1441 m_SimulatorShuttingDown = true;
1442
1431 List<IScriptInstance> instances = new List<IScriptInstance>(); 1443 List<IScriptInstance> instances = new List<IScriptInstance>();
1432 1444
1433 lock (m_Scripts) 1445 lock (m_Scripts)