aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-23 01:02:36 -0700
committerJohn Hurliman2009-10-23 01:02:36 -0700
commit588361e2a2398b963871762c2b5485c6a086cf47 (patch)
tree5be2c6705096817c599075da4e12a0e9b0a4c841 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentAdded VS2010 support to Prebuild and created runprebuild2010.bat (diff)
downloadopensim-SC_OLD-588361e2a2398b963871762c2b5485c6a086cf47.zip
opensim-SC_OLD-588361e2a2398b963871762c2b5485c6a086cf47.tar.gz
opensim-SC_OLD-588361e2a2398b963871762c2b5485c6a086cf47.tar.bz2
opensim-SC_OLD-588361e2a2398b963871762c2b5485c6a086cf47.tar.xz
Experimental change to use an immutable array for iterating ScenePresences, avoiding locking and copying the list each time it is accessed
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs21
1 files changed, 13 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ccfffe7..77706ac 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -869,14 +869,16 @@ namespace OpenSim.Region.Framework.Scenes
869 869
870 m_isChildAgent = false; 870 m_isChildAgent = false;
871 871
872 List<ScenePresence> AnimAgents = m_scene.GetScenePresences(); 872 ScenePresence[] animAgents = m_scene.GetScenePresences();
873 foreach (ScenePresence p in AnimAgents) 873 for (int i = 0; i < animAgents.Length; i++)
874 { 874 {
875 if (p != this) 875 ScenePresence presence = animAgents[i];
876 p.SendAnimPackToClient(ControllingClient); 876
877 if (presence != this)
878 presence.SendAnimPackToClient(ControllingClient);
877 } 879 }
878 m_scene.EventManager.TriggerOnMakeRootAgent(this);
879 880
881 m_scene.EventManager.TriggerOnMakeRootAgent(this);
880 } 882 }
881 883
882 /// <summary> 884 /// <summary>
@@ -2533,9 +2535,12 @@ namespace OpenSim.Region.Framework.Scenes
2533 { 2535 {
2534 m_perfMonMS = Environment.TickCount; 2536 m_perfMonMS = Environment.TickCount;
2535 2537
2536 List<ScenePresence> avatars = m_scene.GetScenePresences(); 2538 ScenePresence[] avatars = m_scene.GetScenePresences();
2537 foreach (ScenePresence avatar in avatars) 2539
2540 for (int i = 0; i < avatars.Length; i++)
2538 { 2541 {
2542 ScenePresence avatar = avatars[i];
2543
2539 // only send if this is the root (children are only "listening posts" in a foreign region) 2544 // only send if this is the root (children are only "listening posts" in a foreign region)
2540 if (!IsChildAgent) 2545 if (!IsChildAgent)
2541 { 2546 {
@@ -2553,7 +2558,7 @@ namespace OpenSim.Region.Framework.Scenes
2553 } 2558 }
2554 } 2559 }
2555 2560
2556 m_scene.StatsReporter.AddAgentUpdates(avatars.Count); 2561 m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
2557 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2562 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2558 2563
2559 //SendAnimPack(); 2564 //SendAnimPack();