From e09ff343fb17269ff3f43dc44c31cfeee923c6b8 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 22 Jul 2008 22:49:13 +0000 Subject: Make QueuePacket() lock free. Eliminates an unneeded lock() --- .../ClientStack/LindenUDP/LLPacketHandler.cs | 39 ++++++++++------------ 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index c4bc6c8..c09da9b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs @@ -251,27 +251,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // Add acks to outgoing packets // - lock(m_PendingAcks) - { - if(m_PendingAcks.Count > 0) - { - int count = m_PendingAcks.Count; - if(count > 10) - count = 10; - packet.Header.AckList = new uint[count]; - - int i = 0; - - foreach (uint ack in new List(m_PendingAcks.Keys)) - { - packet.Header.AckList[i] = ack; - i++; - m_PendingAcks.Remove(ack); - if (i >= 10) // That is how much space there is - break; - } - } - } + if(m_PendingAcks.Count > 0) + { + int count = m_PendingAcks.Count; + if(count > 10) + count = 10; + packet.Header.AckList = new uint[count]; + + int i = 0; + + foreach (uint ack in new List(m_PendingAcks.Keys)) + { + packet.Header.AckList[i] = ack; + i++; + m_PendingAcks.Remove(ack); + if (i >= 10) // That is how much space there is + break; + } + } packet.TickCount = System.Environment.TickCount; -- cgit v1.1