From e7e8a7ab4de8f29a3b646574033e4d8117cc7cc0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 3 Feb 2018 19:34:17 +0000 Subject: just DIE damm thread (recent monos issue) --- OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs | 32 ++++++++++++++-------- .../ScriptEngine/XMREngine/XMRScriptThread.cs | 3 +- 2 files changed, 23 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs b/OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs index 5889451..51c7618 100644 --- a/OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs +++ b/OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs @@ -682,25 +682,33 @@ namespace OpenSim.Region.ScriptEngine.XMREngine * one to finish (ie, script gets to CheckRun() call). */ m_Exiting = true; - for (int i = 0; i < numThreadScriptWorkers; i ++) { + for (int i = 0; i < numThreadScriptWorkers; i ++) + { XMRScriptThread scriptThread = m_ScriptThreads[i]; - if (scriptThread != null) { + if (scriptThread != null) + { scriptThread.Terminate(); m_ScriptThreads[i] = null; } } - if (m_SleepThread != null) { - lock (m_SleepQueue) { + + if (m_SleepThread != null) + { + lock (m_SleepQueue) + { Monitor.PulseAll (m_SleepQueue); } - m_SleepThread.Join(); + if(!m_SleepThread.Join(250)) + m_SleepThread.Abort(); m_SleepThread = null; } - if (m_SliceThread != null) { +/* + if (m_SliceThread != null) + { m_SliceThread.Join(); m_SliceThread = null; } - +*/ m_Scene.EventManager.OnFrame -= OnFrame; m_Scene.EventManager.OnRezScript -= OnRezScript; m_Scene.EventManager.OnRemoveScript -= OnRemoveScript; @@ -1759,29 +1767,30 @@ namespace OpenSim.Region.ScriptEngine.XMREngine /** * @brief Thread that runs a time slicer. */ +/* private void RunSliceThread() { int ms = m_Config.GetInt ("TimeSlice", 50); while (!m_Exiting) { UpdateMyThread (); - +*/ /* * Let script run for a little bit. */ - System.Threading.Thread.Sleep (ms); +// System.Threading.Thread.Sleep (ms); /* * If some script is running, flag it to suspend * next time it calls CheckRun(). */ - for (int i = 0; i < numThreadScriptWorkers; i ++) { +/* for (int i = 0; i < numThreadScriptWorkers; i ++) { XMRScriptThread st = m_ScriptThreads[i]; if (st != null) st.TimeSlice(); } } MyThreadExiting (); } - +*/ public void Suspend(UUID itemID, int ms) { XMRInstance instance = GetInstance (itemID); @@ -1960,6 +1969,7 @@ namespace OpenSim.Region.ScriptEngine.XMREngine Thread thread = new Thread (start); thread.Name = name; thread.Priority = priority; + thread.IsBackground = true; thread.Start (); Watchdog.ThreadWatchdogInfo info = new Watchdog.ThreadWatchdogInfo (thread, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS, name); diff --git a/OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs b/OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs index a1238db..ddb3698 100644 --- a/OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs +++ b/OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs @@ -105,7 +105,8 @@ namespace OpenSim.Region.ScriptEngine.XMREngine { m_Exiting = true; WakeUpScriptThread(); - thd.Join(); + if(!thd.Join(250)) + thd.Abort(); lock (m_AllThreads) m_AllThreads.Remove (thd); -- cgit v1.1