From 772c5b7db030eb95da8852d711323244cfa91ab4 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 25 May 2017 06:05:02 +0100
Subject: move assetsconnector threads to whatchdog; Abort all alive threads
known to watchdog before exit
---
OpenSim/Framework/Monitoring/Watchdog.cs | 24 ++++++++++++++++++++++++
OpenSim/Framework/Monitoring/WorkManager.cs | 1 +
OpenSim/Framework/Servers/BaseOpenSimServer.cs | 3 ++-
3 files changed, 27 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 9cc61ee..8a4894e 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -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();
+ }
+ }
+
///
/// Add a thread to the watchdog tracker.
///
diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs
index a3e0390..9d52f71 100644
--- a/OpenSim/Framework/Monitoring/WorkManager.cs
+++ b/OpenSim/Framework/Monitoring/WorkManager.cs
@@ -85,6 +85,7 @@ namespace OpenSim.Framework.Monitoring
public static void Stop()
{
JobEngine.Stop();
+ Watchdog.Stop();
}
///
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index bc68681..81dd357 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -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);
}
--
cgit v1.1