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.cs13
1 files changed, 10 insertions, 3 deletions
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 8a4894e..5fb725c 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -193,7 +193,7 @@ namespace OpenSim.Framework.Monitoring
193 m_watchdogTimer.Dispose(); 193 m_watchdogTimer.Dispose();
194 m_watchdogTimer = null; 194 m_watchdogTimer = null;
195 } 195 }
196 196
197 foreach(ThreadWatchdogInfo twi in m_threads.Values) 197 foreach(ThreadWatchdogInfo twi in m_threads.Values)
198 { 198 {
199 Thread t = twi.Thread; 199 Thread t = twi.Thread;
@@ -341,6 +341,8 @@ namespace OpenSim.Framework.Monitoring
341 /// <param name="e"></param> 341 /// <param name="e"></param>
342 private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) 342 private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
343 { 343 {
344 if(!m_enabled)
345 return;
344 int now = Environment.TickCount & Int32.MaxValue; 346 int now = Environment.TickCount & Int32.MaxValue;
345 int msElapsed = now - LastWatchdogThreadTick; 347 int msElapsed = now - LastWatchdogThreadTick;
346 348
@@ -358,21 +360,26 @@ namespace OpenSim.Framework.Monitoring
358 List<ThreadWatchdogInfo> callbackInfos = null; 360 List<ThreadWatchdogInfo> callbackInfos = null;
359 List<ThreadWatchdogInfo> threadsToRemove = null; 361 List<ThreadWatchdogInfo> threadsToRemove = null;
360 362
363 const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested;
364
361 lock (m_threads) 365 lock (m_threads)
362 { 366 {
363 foreach(ThreadWatchdogInfo threadInfo in m_threads.Values) 367 foreach(ThreadWatchdogInfo threadInfo in m_threads.Values)
364 { 368 {
365 if(threadInfo.Thread.ThreadState == ThreadState.Stopped) 369 if(!m_enabled)
370 return;
371 if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0)
366 { 372 {
367 if(threadsToRemove == null) 373 if(threadsToRemove == null)
368 threadsToRemove = new List<ThreadWatchdogInfo>(); 374 threadsToRemove = new List<ThreadWatchdogInfo>();
369 375
370 threadsToRemove.Add(threadInfo); 376 threadsToRemove.Add(threadInfo);
371 377/*
372 if(callbackInfos == null) 378 if(callbackInfos == null)
373 callbackInfos = new List<ThreadWatchdogInfo>(); 379 callbackInfos = new List<ThreadWatchdogInfo>();
374 380
375 callbackInfos.Add(threadInfo); 381 callbackInfos.Add(threadInfo);
382*/
376 } 383 }
377 else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) 384 else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
378 { 385 {