diff options
author | UbitUmarov | 2016-08-25 23:31:18 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-25 23:31:18 +0100 |
commit | 38ba839eb35987e47b98f795fbdc6083ab48921c (patch) | |
tree | 129d65b5df1677901eb15235526afb47ee41406b /OpenSim | |
parent | send selected objects Proprieties udp part outside update queues and as a ph... (diff) | |
download | opensim-SC-38ba839eb35987e47b98f795fbdc6083ab48921c.zip opensim-SC-38ba839eb35987e47b98f795fbdc6083ab48921c.tar.gz opensim-SC-38ba839eb35987e47b98f795fbdc6083ab48921c.tar.bz2 opensim-SC-38ba839eb35987e47b98f795fbdc6083ab48921c.tar.xz |
watchdog timeouts: replace a silly List copy i added doing it a better way
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Monitoring/Watchdog.cs | 16 |
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) |