From 666626db6d1feeeafafc2c145127f80c7981fc3d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sun, 6 Jul 2008 12:46:17 +0000 Subject: * minor: remove unnecessary locking from SOP.GetInventoryItem() --- .../Scenes/SceneObjectPart.Inventory.cs | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 7e43b44..27b00ee 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -43,9 +43,7 @@ namespace OpenSim.Region.Environment.Scenes private string m_inventoryFileName = String.Empty; private int m_inventoryFileNameSerial = 0; - - /// /// Serial count for inventory file , used to tell if inventory has changed /// no need for this to be part of Database backup @@ -56,9 +54,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// Holds in memory prim inventory /// - protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary(); - - + protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary(); /// /// Tracks whether inventory has changed since the last persistent backup @@ -345,21 +341,12 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// null if the item does not exist - public TaskInventoryItem GetInventoryItem(LLUUID itemID) + public TaskInventoryItem GetInventoryItem(LLUUID itemId) { - lock (m_taskInventory) - { - if (m_taskInventory.ContainsKey(itemID)) - { -// m_log.DebugFormat( -// "[PRIM INVENTORY]: Retrieved task inventory item {0}, {1} from prim {2}, {3}", -// m_taskInventory[itemID].Name, itemID, Name, UUID); - - return m_taskInventory[itemID]; - } - } - - return null; + TaskInventoryItem item; + m_taskInventory.TryGetValue(itemId, out item); + + return item; } /// @@ -367,7 +354,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// The updated item. An item with the same id must already exist /// in this prim's inventory. - /// false if the item did not exist, true if the update occurred succesfully + /// false if the item did not exist, true if the update occurred successfully public bool UpdateInventoryItem(TaskInventoryItem item) { lock (m_taskInventory) -- cgit v1.1