aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Monitoring')
-rw-r--r--OpenSim/Framework/Monitoring/JobEngine.cs7
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs13
2 files changed, 15 insertions, 5 deletions
diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs
index 0a39e4b..a6a059d 100644
--- a/OpenSim/Framework/Monitoring/JobEngine.cs
+++ b/OpenSim/Framework/Monitoring/JobEngine.cs
@@ -136,12 +136,15 @@ namespace OpenSim.Framework.Monitoring
136 if(m_jobQueue.Count <= 0) 136 if(m_jobQueue.Count <= 0)
137 m_cancelSource.Cancel(); 137 m_cancelSource.Cancel();
138 138
139 if(m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop)) 139 m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop);
140 m_finishedProcessingAfterStop.Close(); 140 m_finishedProcessingAfterStop.Close();
141 } 141 }
142 finally 142 finally
143 { 143 {
144 m_cancelSource.Dispose(); 144 if(m_cancelSource != null)
145 m_cancelSource.Dispose();
146 if(m_finishedProcessingAfterStop != null)
147 m_finishedProcessingAfterStop.Dispose();
145 } 148 }
146 } 149 }
147 } 150 }
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 {