From 746dad7b74fb6e353cca3b5a09e0c3be88155784 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 1 Oct 2009 20:32:22 -0700 Subject: Locking the priority queue to see if it gets pass that exception. --- .../Region/ClientStack/LindenUDP/LLImageManager.cs | 35 +++++++++++++++++----- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 70af8e8..97107ce 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -77,7 +77,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP J2KImage imgrequest; // Do a linear search for this texture download - m_priorityQueue.Find(delegate(J2KImage img) { return img.m_requestedUUID == newRequest.RequestedAssetID; }, out imgrequest); + lock (m_priorityQueue) + m_priorityQueue.Find(delegate(J2KImage img) { return img.m_requestedUUID == newRequest.RequestedAssetID; }, out imgrequest); if (imgrequest != null) { @@ -85,7 +86,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP { //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); - try { m_priorityQueue.Delete(imgrequest.m_priorityQueueHandle); } + try + { + lock (m_priorityQueue) + m_priorityQueue.Delete(imgrequest.m_priorityQueueHandle); + } catch (Exception) { } } else @@ -108,8 +113,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP //Update the requested priority imgrequest.m_requestedPriority = newRequest.Priority; - try { m_priorityQueue.Replace(imgrequest.m_priorityQueueHandle, imgrequest); } - catch (Exception) { imgrequest.m_priorityQueueHandle = null; m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); } + try + { + lock (m_priorityQueue) + m_priorityQueue.Replace(imgrequest.m_priorityQueueHandle, imgrequest); + } + catch (Exception) + { + imgrequest.m_priorityQueueHandle = null; + lock (m_priorityQueue) + m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); + } //Run an update imgrequest.RunUpdate(); @@ -152,7 +166,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP imgrequest.m_requestedPriority = newRequest.Priority; //Add this download to the priority queue - m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); + lock (m_priorityQueue) + m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); //Run an update imgrequest.RunUpdate(); @@ -212,7 +227,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { while (m_priorityQueue.Count > 0) { - J2KImage imagereq = m_priorityQueue.FindMax(); + J2KImage imagereq = null; + lock (m_priorityQueue) + imagereq = m_priorityQueue.FindMax(); if (imagereq.m_decoded == true) { @@ -230,7 +247,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (imagereq.SendPackets(m_client, maxpack)) { // Send complete. Destroy any knowledge of this transfer - try { m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); } + try + { + lock (m_priorityQueue) + m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); + } catch (Exception) { } } } -- cgit v1.1