From d90b68c2a637b822b826a0cf3c52991aa9ee2c97 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 May 2017 00:05:35 +0100 Subject: change wrong watchdog stopped thread check code, and don't log it --- OpenSim/Framework/Monitoring/Watchdog.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 8a4894e..5fb725c 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -193,7 +193,7 @@ namespace OpenSim.Framework.Monitoring m_watchdogTimer.Dispose(); m_watchdogTimer = null; } - + foreach(ThreadWatchdogInfo twi in m_threads.Values) { Thread t = twi.Thread; @@ -341,6 +341,8 @@ namespace OpenSim.Framework.Monitoring /// private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) { + if(!m_enabled) + return; int now = Environment.TickCount & Int32.MaxValue; int msElapsed = now - LastWatchdogThreadTick; @@ -358,21 +360,26 @@ namespace OpenSim.Framework.Monitoring List callbackInfos = null; List threadsToRemove = null; + const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested; + lock (m_threads) { foreach(ThreadWatchdogInfo threadInfo in m_threads.Values) { - if(threadInfo.Thread.ThreadState == ThreadState.Stopped) + if(!m_enabled) + return; + if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0) { if(threadsToRemove == null) threadsToRemove = new List(); threadsToRemove.Add(threadInfo); - +/* if(callbackInfos == null) callbackInfos = new List(); callbackInfos.Add(threadInfo); +*/ } else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) { -- cgit v1.1