* Slightly increase ScenePresences locking where it's technically required in SceneGraph

0.6.2-post-fixes
Justin Clarke Casey 2009-01-07 19:33:20 +00:00
parent 8d035b196d
commit 9e297cd722
1 changed files with 25 additions and 17 deletions

View File

@ -837,7 +837,11 @@ namespace OpenSim.Region.Environment.Scenes
protected internal ScenePresence GetScenePresence(UUID agentID) protected internal ScenePresence GetScenePresence(UUID agentID)
{ {
ScenePresence sp; ScenePresence sp;
lock (ScenePresences)
{
ScenePresences.TryGetValue(agentID, out sp); ScenePresences.TryGetValue(agentID, out sp);
}
return sp; return sp;
} }
@ -968,6 +972,9 @@ namespace OpenSim.Region.Environment.Scenes
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
{ {
ScenePresence presence; ScenePresence presence;
lock (ScenePresences)
{
if (ScenePresences.TryGetValue(avatarId, out presence)) if (ScenePresences.TryGetValue(avatarId, out presence))
{ {
avatar = presence; avatar = presence;
@ -985,6 +992,7 @@ namespace OpenSim.Region.Environment.Scenes
// avatarId, m_parentScene.RegionInfo.RegionName); // avatarId, m_parentScene.RegionInfo.RegionName);
//} //}
} }
}
avatar = null; avatar = null;
return false; return false;
@ -1483,7 +1491,7 @@ namespace OpenSim.Region.Environment.Scenes
parenPrim.GetProperties(client); parenPrim.GetProperties(client);
else else
{ {
foreach (ScenePresence p in ScenePresences.Values) foreach (ScenePresence p in GetScenePresences())
{ {
parenPrim.GetProperties(p.ControllingClient); parenPrim.GetProperties(p.ControllingClient);
} }