From 6e609175224791eb1be9f0ce77ffa64fb9b57038 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 6 Jan 2019 02:23:49 +0000
Subject: change its foreach

---
 .../Framework/DoubleDictionaryThreadAbortSafe.cs   | 26 +++++-----------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
index e4c85e4..5b9a45c 100644
--- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
+++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs
@@ -329,28 +329,12 @@ namespace OpenSim.Framework
 
         public void ForEach(Action<TValue> action)
         {
-            bool gotLock = false;
-
-            try
-            {
-                // Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
-                // the acquision inside the main try.  The inner finally block is needed because thread aborts cannot
-                // interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
-                try {}
-                finally
-                {
-                    rwLock.EnterReadLock();
-                    gotLock = true;
-                }
+            TValue[] values = GetArray();
+            if(values == null || values.Length == 0)
+                return;
 
-                foreach (TValue value in Dictionary1.Values)
-                    action(value);
-            }
-            finally
-            {
-                if (gotLock)
-                    rwLock.ExitReadLock();
-            }
+            foreach (TValue value in values)
+                action(value);
         }
 
         public void ForEach(Action<KeyValuePair<TKey1, TValue>> action)
-- 
cgit v1.1