From bafef292f4d41df14a1edeafc7ba5f9d623d7822 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:25:18 +0000 Subject: Take watchdog alarm calling back outside the m_threads lock. This is how it was originally. This stops a very long running alarm callback from causing a problem. --- OpenSim/Framework/Watchdog.cs | 19 ++++++++++++++++--- .../Framework/Scenes/SceneCommunicationService.cs | 4 ++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 4891a66..e93e50e 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -262,7 +262,7 @@ namespace OpenSim.Framework if (callback != null) { - ThreadWatchdogInfo timedOut = null; + List callbackInfos = null; lock (m_threads) { @@ -273,17 +273,30 @@ namespace OpenSim.Framework if (threadInfo.Thread.ThreadState == ThreadState.Stopped) { RemoveThread(threadInfo.Thread.ManagedThreadId); - callback(threadInfo.Thread, threadInfo.LastTick); + + if (callbackInfos == null) + callbackInfos = new List(); + + callbackInfos.Add(threadInfo); } else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) { threadInfo.IsTimedOut = true; if (threadInfo.AlarmIfTimeout) - callback(threadInfo.Thread, threadInfo.LastTick); + { + if (callbackInfos == null) + callbackInfos = new List(); + + callbackInfos.Add(threadInfo); + } } } } + + if (callbackInfos != null) + foreach (ThreadWatchdogInfo callbackInfo in callbackInfos) + callback(callbackInfo.Thread, callbackInfo.LastTick); } m_watchdogTimer.Start(); diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 19c9745..4d98f00 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes // that the region position is cached or performance will degrade Utils.LongToUInts(regionHandle, out x, out y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - bool v = true; - if (! simulatorList.Contains(dest.ServerURI)) +// bool v = true; + if (!simulatorList.Contains(dest.ServerURI)) { // we havent seen this simulator before, add it to the list // and send it an update -- cgit v1.1