From 588361e2a2398b963871762c2b5485c6a086cf47 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 23 Oct 2009 01:02:36 -0700 Subject: Experimental change to use an immutable array for iterating ScenePresences, avoiding locking and copying the list each time it is accessed --- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index a09c8db..ee01c3c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -404,7 +404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins private List doAgentSensor(SenseRepeatClass ts) { - List Presences; + List presences; List sensedEntities = new List(); // If this is an avatar sense by key try to get them directly @@ -414,16 +414,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID); if (p == null) return sensedEntities; - Presences = new List(); - Presences.Add(p); + presences = new List(); + presences.Add(p); } else { - Presences = m_CmdManager.m_ScriptEngine.World.GetScenePresences(); + presences = new List(m_CmdManager.m_ScriptEngine.World.GetScenePresences()); } // If nobody about quit fast - if (Presences.Count == 0) + if (presences.Count == 0) return sensedEntities; SceneObjectPart SensePoint = ts.host; @@ -440,8 +440,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins Vector3 toRegionPos; double dis; - foreach (ScenePresence presence in Presences) + for (int i = 0; i < presences.Count; i++) { + ScenePresence presence = presences[i]; bool keep = true; if (presence.IsDeleted) -- cgit v1.1