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)
{
cmdHandlerThread.Abort();
cmdHandlerThread.Join();
//cmdHandlerThread.Join();
}
}
}

View File

@ -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

View File

@ -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)
{

View File

@ -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());
}
}