aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Watchdog.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Watchdog.cs')
-rw-r--r--OpenSim/Framework/Watchdog.cs19
1 files changed, 16 insertions, 3 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();