aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-02-24 05:25:18 +0000
committerJustin Clark-Casey (justincc)2012-02-24 05:25:18 +0000
commitbafef292f4d41df14a1edeafc7ba5f9d623d7822 (patch)
treefafe03e1890e915c0d8d7375dc4188f434fb37db /OpenSim
parentRename Watchdog.GetThreads() to GetThreadsInfo() to reflect what it actually ... (diff)
downloadopensim-SC_OLD-bafef292f4d41df14a1edeafc7ba5f9d623d7822.zip
opensim-SC_OLD-bafef292f4d41df14a1edeafc7ba5f9d623d7822.tar.gz
opensim-SC_OLD-bafef292f4d41df14a1edeafc7ba5f9d623d7822.tar.bz2
opensim-SC_OLD-bafef292f4d41df14a1edeafc7ba5f9d623d7822.tar.xz
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Watchdog.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs4
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
262 262
263 if (callback != null) 263 if (callback != null)
264 { 264 {
265 ThreadWatchdogInfo timedOut = null; 265 List<ThreadWatchdogInfo> callbackInfos = null;
266 266
267 lock (m_threads) 267 lock (m_threads)
268 { 268 {
@@ -273,17 +273,30 @@ namespace OpenSim.Framework
273 if (threadInfo.Thread.ThreadState == ThreadState.Stopped) 273 if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
274 { 274 {
275 RemoveThread(threadInfo.Thread.ManagedThreadId); 275 RemoveThread(threadInfo.Thread.ManagedThreadId);
276 callback(threadInfo.Thread, threadInfo.LastTick); 276
277 if (callbackInfos == null)
278 callbackInfos = new List<ThreadWatchdogInfo>();
279
280 callbackInfos.Add(threadInfo);
277 } 281 }
278 else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) 282 else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
279 { 283 {
280 threadInfo.IsTimedOut = true; 284 threadInfo.IsTimedOut = true;
281 285
282 if (threadInfo.AlarmIfTimeout) 286 if (threadInfo.AlarmIfTimeout)
283 callback(threadInfo.Thread, threadInfo.LastTick); 287 {
288 if (callbackInfos == null)
289 callbackInfos = new List<ThreadWatchdogInfo>();
290
291 callbackInfos.Add(threadInfo);
292 }
284 } 293 }
285 } 294 }
286 } 295 }
296
297 if (callbackInfos != null)
298 foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
299 callback(callbackInfo.Thread, callbackInfo.LastTick);
287 } 300 }
288 301
289 m_watchdogTimer.Start(); 302 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
156 // that the region position is cached or performance will degrade 156 // that the region position is cached or performance will degrade
157 Utils.LongToUInts(regionHandle, out x, out y); 157 Utils.LongToUInts(regionHandle, out x, out y);
158 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); 158 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
159 bool v = true; 159// bool v = true;
160 if (! simulatorList.Contains(dest.ServerURI)) 160 if (!simulatorList.Contains(dest.ServerURI))
161 { 161 {
162 // we havent seen this simulator before, add it to the list 162 // we havent seen this simulator before, add it to the list
163 // and send it an update 163 // and send it an update