mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
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.
This commit is contained in:
@@ -774,7 +774,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
/// <returns></returns>
|
||||
protected internal List<ScenePresence> GetScenePresences()
|
||||
{
|
||||
return new List<ScenePresence>(ScenePresences.Values);
|
||||
lock (ScenePresences)
|
||||
{
|
||||
return new List<ScenePresence>(ScenePresences.Values);
|
||||
}
|
||||
}
|
||||
|
||||
protected internal List<ScenePresence> GetAvatars()
|
||||
@@ -1085,12 +1088,18 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
protected internal void ForEachClient(Action<IClientAPI> action)
|
||||
{
|
||||
lock (ScenePresences)
|
||||
List<ScenePresence> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user