From 9224b5d68049c0b8b3a5d7a9b3dcd6d5f4c1f005 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 27 Nov 2015 13:32:49 +0000 Subject: [PATCH] revert last change to watchdog timeouts, that should not be needed --- OpenSim/Framework/Monitoring/Watchdog.cs | 50 +++++++++++------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 83f8e016bb..b2c1fb178c 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -332,41 +332,37 @@ namespace OpenSim.Framework.Monitoring if (callback != null) { List callbackInfos = null; - - // get a copy since we may change m_threads List threadsInfo; + lock (m_threads) - threadsInfo = m_threads.Values.ToList(); - - foreach (ThreadWatchdogInfo threadInfo in threadsInfo) { - lock (m_threads) + // get a copy since we may change m_threads + threadsInfo = m_threads.Values.ToList(); + + foreach(ThreadWatchdogInfo threadInfo in threadsInfo) { - if(!m_threads.ContainsValue(threadInfo)) - continue; - } - - if(threadInfo.Thread.ThreadState == ThreadState.Stopped) - { - RemoveThread(threadInfo.Thread.ManagedThreadId); - - if(callbackInfos == null) - callbackInfos = new List(); - - callbackInfos.Add(threadInfo); - } - else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) - { - threadInfo.IsTimedOut = true; - - if(threadInfo.AlarmIfTimeout) + if(threadInfo.Thread.ThreadState == ThreadState.Stopped) { + RemoveThread(threadInfo.Thread.ManagedThreadId); + if(callbackInfos == null) callbackInfos = new List(); - // Send a copy of the watchdog info to prevent race conditions where the watchdog - // thread updates the monitoring info after an alarm has been sent out. - callbackInfos.Add(new ThreadWatchdogInfo(threadInfo)); + callbackInfos.Add(threadInfo); + } + else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) + { + threadInfo.IsTimedOut = true; + + if(threadInfo.AlarmIfTimeout) + { + if(callbackInfos == null) + callbackInfos = new List(); + + // Send a copy of the watchdog info to prevent race conditions where the watchdog + // thread updates the monitoring info after an alarm has been sent out. + callbackInfos.Add(new ThreadWatchdogInfo(threadInfo)); + } } } }