aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring/Watchdog.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Monitoring/Watchdog.cs')
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs18
1 files changed, 10 insertions, 8 deletions
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 4485a9c..b2c1fb1 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -332,29 +332,31 @@ namespace OpenSim.Framework.Monitoring
332 if (callback != null) 332 if (callback != null)
333 { 333 {
334 List<ThreadWatchdogInfo> callbackInfos = null; 334 List<ThreadWatchdogInfo> callbackInfos = null;
335 List<ThreadWatchdogInfo> threadsInfo;
335 336
336 lock (m_threads) 337 lock (m_threads)
337 { 338 {
338 // get a copy since we may change m_threads 339 // get a copy since we may change m_threads
339 List<ThreadWatchdogInfo> threadsInfo = m_threads.Values.ToList(); 340 threadsInfo = m_threads.Values.ToList();
340 foreach (ThreadWatchdogInfo threadInfo in threadsInfo) 341
342 foreach(ThreadWatchdogInfo threadInfo in threadsInfo)
341 { 343 {
342 if (threadInfo.Thread.ThreadState == ThreadState.Stopped) 344 if(threadInfo.Thread.ThreadState == ThreadState.Stopped)
343 { 345 {
344 RemoveThread(threadInfo.Thread.ManagedThreadId); 346 RemoveThread(threadInfo.Thread.ManagedThreadId);
345 347
346 if (callbackInfos == null) 348 if(callbackInfos == null)
347 callbackInfos = new List<ThreadWatchdogInfo>(); 349 callbackInfos = new List<ThreadWatchdogInfo>();
348 350
349 callbackInfos.Add(threadInfo); 351 callbackInfos.Add(threadInfo);
350 } 352 }
351 else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) 353 else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
352 { 354 {
353 threadInfo.IsTimedOut = true; 355 threadInfo.IsTimedOut = true;
354 356
355 if (threadInfo.AlarmIfTimeout) 357 if(threadInfo.AlarmIfTimeout)
356 { 358 {
357 if (callbackInfos == null) 359 if(callbackInfos == null)
358 callbackInfos = new List<ThreadWatchdogInfo>(); 360 callbackInfos = new List<ThreadWatchdogInfo>();
359 361
360 // Send a copy of the watchdog info to prevent race conditions where the watchdog 362 // Send a copy of the watchdog info to prevent race conditions where the watchdog
@@ -365,7 +367,7 @@ namespace OpenSim.Framework.Monitoring
365 } 367 }
366 } 368 }
367 369
368 if (callbackInfos != null) 370 if(callbackInfos != null)
369 foreach (ThreadWatchdogInfo callbackInfo in callbackInfos) 371 foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
370 callback(callbackInfo); 372 callback(callbackInfo);
371 } 373 }