aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs27
1 files changed, 24 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 485531d..303e5e4 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -210,6 +210,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
210 m_Scene.EventManager.OnScriptReset += OnScriptReset; 210 m_Scene.EventManager.OnScriptReset += OnScriptReset;
211 m_Scene.EventManager.OnStartScript += OnStartScript; 211 m_Scene.EventManager.OnStartScript += OnStartScript;
212 m_Scene.EventManager.OnStopScript += OnStopScript; 212 m_Scene.EventManager.OnStopScript += OnStopScript;
213 m_Scene.EventManager.OnShutdown += OnShutdown;
213 214
214 m_AsyncCommands = new AsyncCommandManager(this); 215 m_AsyncCommands = new AsyncCommandManager(this);
215 216
@@ -247,7 +248,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
247 Object[] p = (Object[])o; 248 Object[] p = (Object[])o;
248 int saveTime = (int)p[0]; 249 int saveTime = (int)p[0];
249 250
250 System.Threading.Thread.Sleep(saveTime); 251 if (saveTime > 0)
252 System.Threading.Thread.Sleep(saveTime);
251 253
252// m_log.Debug("[XEngine] Backing up script states"); 254// m_log.Debug("[XEngine] Backing up script states");
253 255
@@ -275,8 +277,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
275 277
276 instances.Clear(); 278 instances.Clear();
277 279
278 m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoBackup), 280 if (saveTime > 0)
279 new Object[] { saveTime }); 281 m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoBackup),
282 new Object[] { saveTime });
280 283
281 return 0; 284 return 0;
282 } 285 }
@@ -840,5 +843,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
840 { 843 {
841 return GetScriptState(itemID); 844 return GetScriptState(itemID);
842 } 845 }
846
847 public void OnShutdown()
848 {
849 List<IScriptInstance> instances = new List<IScriptInstance>();
850
851 lock (m_Scripts)
852 {
853 foreach (IScriptInstance instance in m_Scripts.Values)
854 instances.Add(instance);
855 }
856
857 foreach (IScriptInstance i in instances)
858 {
859 i.Stop(50);
860 }
861
862 DoBackup(new Object[] {0});
863 }
843 } 864 }
844} 865}