Fixes to ScriptEngine thread cleanup on destructor

ThreadPoolClientBranch
Tedd Hansen 2008-02-21 23:43:58 +00:00
parent d4905812bc
commit f75e418211
4 changed files with 14 additions and 17 deletions

View File

@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
if (cmdHandlerThread.IsAlive == true) if (cmdHandlerThread.IsAlive == true)
{ {
cmdHandlerThread.Abort(); cmdHandlerThread.Abort();
cmdHandlerThread.Join(); //cmdHandlerThread.Join();
} }
} }
} }

View File

@ -233,15 +233,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
if (eventQueueThreads != null && eventQueueThreads != null) if (eventQueueThreads != null && eventQueueThreads != null)
{ {
// Kill worker threads // Kill worker threads
lock (eventQueueThreads) //lock (eventQueueThreads)
{ //{
foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads) foreach (EventQueueThreadClass EventQueueThread in new ArrayList(eventQueueThreads))
{ {
AbortThreadClass(EventQueueThread); AbortThreadClass(EventQueueThread);
} }
eventQueueThreads.Clear(); //eventQueueThreads.Clear();
staticGlobalEventQueueThreads.Clear(); //staticGlobalEventQueueThreads.Clear();
} //}
} }
// Remove all entries from our event queue // Remove all entries from our event queue
@ -275,10 +275,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
} }
catch (Exception ex) 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]: 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]: 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 #endregion

View File

@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
try try
{ {
EventQueueThread.Abort(); // Send abort EventQueueThread.Abort(); // Send abort
EventQueueThread.Join(); // Wait for it //EventQueueThread.Join(); // Wait for it
} }
catch (Exception) catch (Exception)
{ {

View File

@ -88,23 +88,20 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
private void StopMaintenanceThread() private void StopMaintenanceThread()
{ {
#if DEBUG #if DEBUG
m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called"); //m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called");
#endif #endif
PleaseShutdown = true; PleaseShutdown = true;
Thread.Sleep(100); Thread.Sleep(100);
try try
{ {
if (MaintenanceThreadThread != null) if (MaintenanceThreadThread != null && MaintenanceThreadThread.IsAlive)
{
if (MaintenanceThreadThread.IsAlive)
{ {
MaintenanceThreadThread.Abort(); MaintenanceThreadThread.Abort();
} }
}
} }
catch (Exception ex) 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());
} }
} }