From f75e418211fa072b03515e19f770ee20ba9a80d6 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Thu, 21 Feb 2008 23:43:58 +0000 Subject: Fixes to ScriptEngine thread cleanup on destructor --- .../Common/ScriptEngineBase/AsyncLSLCommandManager.cs | 2 +- .../Common/ScriptEngineBase/EventQueueManager.cs | 18 +++++++++--------- .../Common/ScriptEngineBase/EventQueueThreadClass.cs | 2 +- .../Common/ScriptEngineBase/MaintenanceThread.cs | 9 +++------ 4 files changed, 14 insertions(+), 17 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs index 81e3438..fbdfff8 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs @@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase if (cmdHandlerThread.IsAlive == true) { cmdHandlerThread.Abort(); - cmdHandlerThread.Join(); + //cmdHandlerThread.Join(); } } } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index eaffe3f..aa7e3e9 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs @@ -233,15 +233,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase if (eventQueueThreads != null && eventQueueThreads != null) { // Kill worker threads - lock (eventQueueThreads) - { - foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads) + //lock (eventQueueThreads) + //{ + foreach (EventQueueThreadClass EventQueueThread in new ArrayList(eventQueueThreads)) { AbortThreadClass(EventQueueThread); } - eventQueueThreads.Clear(); - staticGlobalEventQueueThreads.Clear(); - } + //eventQueueThreads.Clear(); + //staticGlobalEventQueueThreads.Clear(); + //} } // Remove all entries from our event queue @@ -275,10 +275,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } catch (Exception ex) { - m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:"); - m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString()); + //m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:"); + //m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString()); } - m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count); + //m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count); } #endregion diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index cf66e7a..11fd896 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs @@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase try { EventQueueThread.Abort(); // Send abort - EventQueueThread.Join(); // Wait for it + //EventQueueThread.Join(); // Wait for it } catch (Exception) { diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index 4776ffe..f959a5b 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs @@ -88,23 +88,20 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase private void StopMaintenanceThread() { #if DEBUG - m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called"); + //m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called"); #endif PleaseShutdown = true; Thread.Sleep(100); try { - if (MaintenanceThreadThread != null) - { - if (MaintenanceThreadThread.IsAlive) + if (MaintenanceThreadThread != null && MaintenanceThreadThread.IsAlive) { MaintenanceThreadThread.Abort(); } - } } catch (Exception ex) { - m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString()); + //m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString()); } } -- cgit v1.1