From e80dcfa9f6eb14f67f7a7bdf4ae7a596323e156c Mon Sep 17 00:00:00 2001
From: diva
Date: Thu, 15 Jan 2009 23:37:49 +0000
Subject: Eased the locking times of ScenePresences. No locks were removed,
just the locking periods changed. * Added an additional lock in
GetScenePresences() * Changed ForEachClient to use GetScenePresences()
instead of the main ScenePresences dictionary, so that there is no need to
lock.
---
OpenSim/Region/Environment/Scenes/SceneGraph.cs | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes/SceneGraph.cs')
diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
index be2fb46..940aee6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
@@ -774,7 +774,10 @@ namespace OpenSim.Region.Environment.Scenes
///
protected internal List GetScenePresences()
{
- return new List(ScenePresences.Values);
+ lock (ScenePresences)
+ {
+ return new List(ScenePresences.Values);
+ }
}
protected internal List GetAvatars()
@@ -1085,12 +1088,18 @@ namespace OpenSim.Region.Environment.Scenes
protected internal void ForEachClient(Action action)
{
- lock (ScenePresences)
+ List splist = GetScenePresences();
+ foreach (ScenePresence presence in splist)
{
- foreach (ScenePresence presence in ScenePresences.Values)
+ try
{
action(presence.ControllingClient);
}
+ catch (Exception e)
+ {
+ // Catch it and move on. This includes situations where splist has inconsistent info
+ m_log.WarnFormat("[SCENE]: Problem processing action in ForEachClient: ", e.Message);
+ }
}
}
--
cgit v1.1