* 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.
0.6.1-post-fixes
Adam Frisby 2008-11-24 15:14:33 +00:00
parent 2305ef61a5
commit 2a8ff937d5
3 changed files with 8 additions and 32 deletions

View File

@ -664,16 +664,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public void UpdateLandPrimCounts() public void UpdateLandPrimCounts()
{ {
ResetAllLandPrimCounts(); 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);
}
} }
} }
} }

View File

@ -244,21 +244,6 @@ namespace OpenSim.Region.Environment.Scenes
// set { m_sceneGraph.SceneObjects = value; } // set { m_sceneGraph.SceneObjects = value; }
// } // }
/**
/// <summary>
/// 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()
/// </summary>
public Dictionary<UUID, EntityBase> Entities
{
get { return m_sceneGraph.Entities; }
set { m_sceneGraph.Entities = value; }
}
*/
public EntityManager Entities public EntityManager Entities
{ {
get { return m_sceneGraph.Entities; } get { return m_sceneGraph.Entities; }
@ -609,14 +594,11 @@ namespace OpenSim.Region.Environment.Scenes
if (ScriptEngine) if (ScriptEngine)
{ {
m_log.Info("Stopping all Scripts in Scene"); 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();
}
} }
} }
} }

View File

@ -788,10 +788,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
EntityBase SensedObject; EntityBase SensedObject;
lock (World.Entities) World.Entities.TryGetValue(objecUUID, out SensedObject);
{
World.Entities.TryGetValue(objecUUID, out SensedObject);
}
if (SensedObject == null) if (SensedObject == null)
return String.Empty; return String.Empty;