move assetsconnector threads to whatchdog; Abort all alive threads known to watchdog before exit

This commit is contained in:
UbitUmarov
2017-05-25 06:05:02 +01:00
parent 0d31898fd6
commit 772c5b7db0
6 changed files with 30 additions and 2 deletions

View File

@@ -180,6 +180,30 @@ namespace OpenSim.Framework.Monitoring
m_watchdogTimer.Elapsed += WatchdogTimerElapsed;
}
public static void Stop()
{
if(m_threads == null)
return;
lock(m_threads)
{
m_enabled = false;
if(m_watchdogTimer != null)
{
m_watchdogTimer.Dispose();
m_watchdogTimer = null;
}
foreach(ThreadWatchdogInfo twi in m_threads.Values)
{
Thread t = twi.Thread;
if(t.IsAlive)
t.Abort();
}
m_threads.Clear();
}
}
/// <summary>
/// Add a thread to the watchdog tracker.
/// </summary>

View File

@@ -85,6 +85,7 @@ namespace OpenSim.Framework.Monitoring
public static void Stop()
{
JobEngine.Stop();
Watchdog.Stop();
}
/// <summary>

View File

@@ -119,9 +119,10 @@ namespace OpenSim.Framework.Servers
Thread.Sleep(1000);
RemovePIDFile();
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
if (!SuppressExit)
if (!SuppressExit)
Environment.Exit(0);
}