aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index b2c1fb1..ff439f5 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -332,18 +332,18 @@ 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 List<ThreadWatchdogInfo> threadsToRemove = null;
336 336
337 lock (m_threads) 337 lock (m_threads)
338 { 338 {
339 // get a copy since we may change m_threads 339 foreach(ThreadWatchdogInfo threadInfo in m_threads.Values)
340 threadsInfo = m_threads.Values.ToList();
341
342 foreach(ThreadWatchdogInfo threadInfo in threadsInfo)
343 { 340 {
344 if(threadInfo.Thread.ThreadState == ThreadState.Stopped) 341 if(threadInfo.Thread.ThreadState == ThreadState.Stopped)
345 { 342 {
346 RemoveThread(threadInfo.Thread.ManagedThreadId); 343 if(threadsToRemove == null)
344 threadsToRemove = new List<ThreadWatchdogInfo>();
345
346 threadsToRemove.Add(threadInfo);
347 347
348 if(callbackInfos == null) 348 if(callbackInfos == null)
349 callbackInfos = new List<ThreadWatchdogInfo>(); 349 callbackInfos = new List<ThreadWatchdogInfo>();
@@ -365,6 +365,10 @@ namespace OpenSim.Framework.Monitoring
365 } 365 }
366 } 366 }
367 } 367 }
368
369 if(threadsToRemove != null)
370 foreach(ThreadWatchdogInfo twi in threadsToRemove)
371 RemoveThread(twi.Thread.ManagedThreadId);
368 } 372 }
369 373
370 if(callbackInfos != null) 374 if(callbackInfos != null)