aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
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/CoreModules
parentAdded VS2010 support to Prebuild and created runprebuild2010.bat (diff)
downloadopensim-SC-588361e2a2398b963871762c2b5485c6a086cf47.zip
opensim-SC-588361e2a2398b963871762c2b5485c6a086cf47.tar.gz
opensim-SC-588361e2a2398b963871762c2b5485c6a086cf47.tar.bz2
opensim-SC-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/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs7
3 files changed, 21 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 9387bce..61b6d65 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -96,12 +96,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
96 else 96 else
97 { 97 {
98 bool foundResult = false; 98 bool foundResult = false;
99 string resultstring = ""; 99 string resultstring = String.Empty;
100 List<ScenePresence> allav = DeadAvatar.Scene.GetScenePresences(); 100 ScenePresence[] allav = DeadAvatar.Scene.GetScenePresences();
101 try 101 try
102 { 102 {
103 foreach (ScenePresence av in allav) 103 for (int i = 0; i < allav.Length; i++)
104 { 104 {
105 ScenePresence av = allav[i];
106
105 if (av.LocalId == killerObjectLocalID) 107 if (av.LocalId == killerObjectLocalID)
106 { 108 {
107 av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname); 109 av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index ebebaf9..72ec869 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -85,10 +85,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
85 85
86 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 86 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
87 { 87 {
88 List<ScenePresence> presenceList = m_scene.GetScenePresences(); 88 ScenePresence[] presenceList = m_scene.GetScenePresences();
89 89
90 foreach (ScenePresence presence in presenceList) 90 for (int i = 0; i < presenceList.Length; i++)
91 { 91 {
92 ScenePresence presence = presenceList[i];
93
92 if (presence.Firstname == firstName && presence.Lastname == lastName) 94 if (presence.Firstname == firstName && presence.Lastname == lastName)
93 { 95 {
94 presence.ControllingClient.SendAgentAlertMessage(message, modal); 96 presence.ControllingClient.SendAgentAlertMessage(message, modal);
@@ -99,10 +101,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
99 101
100 public void SendGeneralAlert(string message) 102 public void SendGeneralAlert(string message)
101 { 103 {
102 List<ScenePresence> presenceList = m_scene.GetScenePresences(); 104 ScenePresence[] presenceList = m_scene.GetScenePresences();
103 105
104 foreach (ScenePresence presence in presenceList) 106 for (int i = 0; i < presenceList.Length; i++)
105 { 107 {
108 ScenePresence presence = presenceList[i];
109
106 if (!presence.IsChildAgent) 110 if (!presence.IsChildAgent)
107 presence.ControllingClient.SendAlertMessage(message); 111 presence.ControllingClient.SendAlertMessage(message);
108 } 112 }
@@ -150,10 +154,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
150 public void SendNotificationToUsersInRegion( 154 public void SendNotificationToUsersInRegion(
151 UUID fromAvatarID, string fromAvatarName, string message) 155 UUID fromAvatarID, string fromAvatarName, string message)
152 { 156 {
153 List<ScenePresence> presenceList = m_scene.GetScenePresences(); 157 ScenePresence[] presences = m_scene.GetScenePresences();
154 158
155 foreach (ScenePresence presence in presenceList) 159 for (int i = 0; i < presences.Length; i++)
156 { 160 {
161 ScenePresence presence = presences[i];
157 if (!presence.IsChildAgent) 162 if (!presence.IsChildAgent)
158 presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); 163 presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
159 } 164 }
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 3bb162e..e3a395e 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -414,9 +414,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
414 private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) 414 private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
415 { 415 {
416 // Get a fresh list that will not change as people get teleported away 416 // Get a fresh list that will not change as people get teleported away
417 List<ScenePresence> prescences = m_scene.GetScenePresences(); 417 ScenePresence[] presences = m_scene.GetScenePresences();
418 foreach (ScenePresence p in prescences) 418
419 for (int i = 0; i < presences.Length; i++)
419 { 420 {
421 ScenePresence p = presences[i];
422
420 if (p.UUID != senderID) 423 if (p.UUID != senderID)
421 { 424 {
422 // make sure they are still there, we could be working down a long list 425 // make sure they are still there, we could be working down a long list