From 68961ec0923fb613eae72f0f83ad3349e608cc05 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 7 Oct 2009 20:36:24 -0700 Subject: One last attempt at tunning the locking/no locking behaviour. The previous one was too lax and made the important login packets fail. --- .../ClientStack/LindenUDP/LLUDPClientCollection.cs | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs index 36e1f49..f6ccf01 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs @@ -247,16 +247,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP ////return success; - //lock (m_sync) - // return Dictionary2.TryGetValue(key, out value); - - try - { + lock (m_sync) return Dictionary2.TryGetValue(key, out value); - } - catch { } - value = null; - return false; + + //try + //{ + // return Dictionary2.TryGetValue(key, out value); + //} + //catch { } + //value = null; + //return false; } @@ -268,8 +268,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP //try { Parallel.ForEach(Array, action); } //finally { if (doLock) rwLock.ExitUpgradeableReadLock(); } + LLUDPClient[] localArray = null; lock (m_sync) - Parallel.ForEach(Array, action); + { + localArray = new LLUDPClient[Array.Length]; + Array.CopyTo(localArray, 0); + } + + Parallel.ForEach(localArray, action); } } -- cgit v1.1