From 2a8ff937d513abbd84a96cbfdbe74bc710b60e6a Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 24 Nov 2008 15:14:33 +0000 Subject: * Removed more locks on Entities * Entities should now in theory be lock-free externally. * Other properties may cause blocking however[?]. * ScenePresence maintains separate locks so isn't fixed by this commit. --- .../Modules/World/Land/LandManagementModule.cs | 11 ++++------ OpenSim/Region/Environment/Scenes/Scene.cs | 24 +++------------------- .../Shared/Api/Implementation/LSL_Api.cs | 5 +---- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index d33201f..68aee86 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -664,16 +664,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void UpdateLandPrimCounts() { ResetAllLandPrimCounts(); - lock (m_scene.Entities) + foreach (EntityBase obj in m_scene.Entities) { - foreach (EntityBase obj in m_scene.Entities) + if (obj != null) { - if (obj != null) + if ((obj is SceneObjectGroup) && !obj.IsDeleted && !((SceneObjectGroup) obj).IsAttachment) { - if ((obj is SceneObjectGroup) && !((SceneObjectGroup)obj).IsDeleted && !((SceneObjectGroup)obj).IsAttachment) - { - m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj); - } + m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup) obj); } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 55e8634..c20c718 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -244,21 +244,6 @@ namespace OpenSim.Region.Environment.Scenes // set { m_sceneGraph.SceneObjects = value; } // } - /** - /// - /// The dictionary of all entities in this scene. The contents of this dictionary may be changed at any time. - /// If you wish to add or remove entities, please use the appropriate method for that entity rather than - /// editing this dictionary directly. - /// - /// If you want a list of entities where the list itself is guaranteed not to change, please use - /// GetEntities() - /// - public Dictionary Entities - { - get { return m_sceneGraph.Entities; } - set { m_sceneGraph.Entities = value; } - } - */ public EntityManager Entities { get { return m_sceneGraph.Entities; } @@ -609,14 +594,11 @@ namespace OpenSim.Region.Environment.Scenes if (ScriptEngine) { m_log.Info("Stopping all Scripts in Scene"); - lock (Entities) + foreach (EntityBase ent in Entities) { - foreach (EntityBase ent in Entities) + if (ent is SceneObjectGroup) { - if (ent is SceneObjectGroup) - { - ((SceneObjectGroup)ent).RemoveScriptInstances(); - } + ((SceneObjectGroup) ent).RemoveScriptInstances(); } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7ccd71c..17dca98 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -788,10 +788,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } EntityBase SensedObject; - lock (World.Entities) - { - World.Entities.TryGetValue(objecUUID, out SensedObject); - } + World.Entities.TryGetValue(objecUUID, out SensedObject); if (SensedObject == null) return String.Empty; -- cgit v1.1