aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorCasperW2009-11-24 18:02:12 +0100
committerCasperW2009-11-24 18:02:12 +0100
commitd1147136946daf14724183b3191119be44ff8b16 (patch)
treefd5c056348acdd0ea82f4c797d15bcae3336ee28 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentSwap the locking of m_EventQueue and m_Script to ease locks on script invento... (diff)
downloadopensim-SC_OLD-d1147136946daf14724183b3191119be44ff8b16.zip
opensim-SC_OLD-d1147136946daf14724183b3191119be44ff8b16.tar.gz
opensim-SC_OLD-d1147136946daf14724183b3191119be44ff8b16.tar.bz2
opensim-SC_OLD-d1147136946daf14724183b3191119be44ff8b16.tar.xz
Drop all locking of part.TaskInventory in favour of a ReaderWriterLockSlim lock handler. This gives us:
- Faster prim inventory actions. Multiple threads can read at once. - Fixes the known prim inventory thread locks - In the event of a thread lock occurring, it will usually self heal after sixty seconds with an error message in the console
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs38
1 files changed, 21 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cdec135..bbece2f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -389,12 +389,16 @@ namespace OpenSim.Region.Framework.Scenes
389 } 389 }
390 390
391 /// <value> 391 /// <value>
392 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 392 /// Get the inventory list
393 /// </value> 393 /// </value>
394 public TaskInventoryDictionary TaskInventory 394 public TaskInventoryDictionary TaskInventory
395 { 395 {
396 get { return m_inventory.Items; } 396 get {
397 set { m_inventory.Items = value; } 397 return m_inventory.Items;
398 }
399 set {
400 m_inventory.Items = value;
401 }
398 } 402 }
399 403
400 public uint ObjectFlags 404 public uint ObjectFlags
@@ -2101,17 +2105,18 @@ namespace OpenSim.Region.Framework.Scenes
2101 //Trys to fetch sound id from prim's inventory. 2105 //Trys to fetch sound id from prim's inventory.
2102 //Prim's inventory doesn't support non script items yet 2106 //Prim's inventory doesn't support non script items yet
2103 2107
2104 lock (TaskInventory) 2108 TaskInventory.LockItemsForRead(true);
2109
2110 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2105 { 2111 {
2106 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2112 if (item.Value.Name == sound)
2107 { 2113 {
2108 if (item.Value.Name == sound) 2114 soundID = item.Value.ItemID;
2109 { 2115 break;
2110 soundID = item.Value.ItemID;
2111 break;
2112 }
2113 } 2116 }
2114 } 2117 }
2118
2119 TaskInventory.LockItemsForRead(false);
2115 } 2120 }
2116 2121
2117 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2122 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2457,17 +2462,16 @@ namespace OpenSim.Region.Framework.Scenes
2457 if (!UUID.TryParse(sound, out soundID)) 2462 if (!UUID.TryParse(sound, out soundID))
2458 { 2463 {
2459 // search sound file from inventory 2464 // search sound file from inventory
2460 lock (TaskInventory) 2465 TaskInventory.LockItemsForRead(true);
2466 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2461 { 2467 {
2462 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2468 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2463 { 2469 {
2464 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2470 soundID = item.Value.ItemID;
2465 { 2471 break;
2466 soundID = item.Value.ItemID;
2467 break;
2468 }
2469 } 2472 }
2470 } 2473 }
2474 TaskInventory.LockItemsForRead(false);
2471 } 2475 }
2472 2476
2473 if (soundID == UUID.Zero) 2477 if (soundID == UUID.Zero)