From fa55fc89d8ab014217b58f78829cce006186b486 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Fri, 10 Oct 2008 13:46:43 +0000 Subject: * Fixed a potential threading issue with EventQueueGet leading to spontaneous crashes. --- .../Modules/Framework/EventQueueGetModule.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs index 78e2df5..5f20dc1 100644 --- a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs +++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs @@ -132,12 +132,16 @@ namespace OpenSim.Region.Environment.Modules.Framework private BlockingLLSDQueue GetQueue(UUID agentId) { - if (!queues.ContainsKey(agentId)) + lock (queues) { - m_log.DebugFormat("[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName); - queues[agentId] = new BlockingLLSDQueue(); + if (!queues.ContainsKey(agentId)) + { + m_log.DebugFormat("[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", agentId, + m_scene.RegionInfo.RegionName); + queues[agentId] = new BlockingLLSDQueue(); + } + return queues[agentId]; } - return queues[agentId]; } @@ -164,7 +168,10 @@ namespace OpenSim.Region.Environment.Modules.Framework private void ClientClosed(UUID AgentID) { - queues.Remove(AgentID); + lock (queues) + { + queues.Remove(AgentID); + } List removeitems = new List(); lock (m_AvatarQueueUUIDMapping) { -- cgit v1.1