diff options
author | Adam Frisby | 2008-11-24 15:09:25 +0000 |
---|---|---|
committer | Adam Frisby | 2008-11-24 15:09:25 +0000 |
commit | 2305ef61a563917ad7be0f98f18a0163bc33532a (patch) | |
tree | be377172c05b76107b3b20d63c5677ff334515a4 /OpenSim/Region | |
parent | * Swaps Scene.Entities Dictionary for EntityManager. (diff) | |
download | opensim-SC_OLD-2305ef61a563917ad7be0f98f18a0163bc33532a.zip opensim-SC_OLD-2305ef61a563917ad7be0f98f18a0163bc33532a.tar.gz opensim-SC_OLD-2305ef61a563917ad7be0f98f18a0163bc33532a.tar.bz2 opensim-SC_OLD-2305ef61a563917ad7be0f98f18a0163bc33532a.tar.xz |
* Refactored a number of locks into EntityManager to limit the scope of the locks.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneGraph.cs | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs index 2c75867..0c4e899 100644 --- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs | |||
@@ -117,11 +117,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
117 | ScenePresences.Clear(); | 117 | ScenePresences.Clear(); |
118 | } | 118 | } |
119 | 119 | ||
120 | //SceneObjects.Clear(); | 120 | Entities.Clear(); |
121 | lock (Entities) | ||
122 | { | ||
123 | Entities.Clear(); | ||
124 | } | ||
125 | } | 121 | } |
126 | 122 | ||
127 | #region Update Methods | 123 | #region Update Methods |
@@ -266,12 +262,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
266 | 262 | ||
267 | sceneObject.AttachToScene(m_parentScene); | 263 | sceneObject.AttachToScene(m_parentScene); |
268 | 264 | ||
269 | lock (Entities) | 265 | lock (sceneObject) |
270 | { | 266 | { |
271 | if (!Entities.ContainsKey(sceneObject.UUID)) | 267 | if (!Entities.ContainsKey(sceneObject.UUID)) |
272 | { | 268 | { |
273 | // QuadTree.AddSceneObject(sceneObject); | 269 | Entities.Add(sceneObject); |
274 | Entities.Add(sceneObject.UUID, sceneObject); | ||
275 | m_numPrim += sceneObject.Children.Count; | 270 | m_numPrim += sceneObject.Children.Count; |
276 | 271 | ||
277 | if (attachToBackup) | 272 | if (attachToBackup) |
@@ -279,30 +274,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
279 | 274 | ||
280 | return true; | 275 | return true; |
281 | } | 276 | } |
282 | |||
283 | return false; | ||
284 | } | 277 | } |
278 | |||
279 | return false; | ||
285 | } | 280 | } |
286 | 281 | ||
287 | /// <summary> | 282 | /// <summary> |
288 | /// Delete an object from the scene | 283 | /// Delete an object from the scene |
289 | /// </summary> | 284 | /// </summary> |
290 | /// <param name="sceneObject"></param> | ||
291 | /// <returns>true if the object was deleted, false if there was no object to delete</returns> | 285 | /// <returns>true if the object was deleted, false if there was no object to delete</returns> |
292 | protected internal bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) | 286 | protected internal bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) |
293 | { | 287 | { |
294 | lock (Entities) | 288 | if (Entities.ContainsKey(uuid)) |
295 | { | 289 | { |
296 | if (Entities.ContainsKey(uuid)) | 290 | if (!resultOfObjectLinked) |
297 | { | 291 | { |
298 | if (!resultOfObjectLinked) | 292 | m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; |
299 | { | ||
300 | m_numPrim -= ((SceneObjectGroup)Entities[uuid]).Children.Count; | ||
301 | } | ||
302 | Entities.Remove(uuid); | ||
303 | |||
304 | return true; | ||
305 | } | 293 | } |
294 | Entities.Remove(uuid); | ||
295 | |||
296 | return true; | ||
306 | } | 297 | } |
307 | 298 | ||
308 | return false; | 299 | return false; |
@@ -615,10 +606,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
615 | presence.AddToPhysicalScene(); | 606 | presence.AddToPhysicalScene(); |
616 | } | 607 | } |
617 | 608 | ||
618 | lock (Entities) | 609 | Entities[presence.UUID] = presence; |
619 | { | ||
620 | Entities[presence.UUID] = presence; | ||
621 | } | ||
622 | 610 | ||
623 | lock (ScenePresences) | 611 | lock (ScenePresences) |
624 | { | 612 | { |
@@ -631,16 +619,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
631 | /// </summary> | 619 | /// </summary> |
632 | protected internal void RemoveScenePresence(UUID agentID) | 620 | protected internal void RemoveScenePresence(UUID agentID) |
633 | { | 621 | { |
634 | lock (Entities) | 622 | if (!Entities.Remove(agentID)) |
635 | { | 623 | { |
636 | if (!Entities.Remove(agentID)) | 624 | m_log.WarnFormat( |
637 | { | 625 | "[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", |
638 | m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", agentID); | 626 | agentID); |
639 | } | ||
640 | // else | ||
641 | // { | ||
642 | // m_log.InfoFormat("[SCENE] Removed scene presence {0} from entities list", agentID); | ||
643 | // } | ||
644 | } | 627 | } |
645 | 628 | ||
646 | lock (ScenePresences) | 629 | lock (ScenePresences) |
@@ -1668,10 +1651,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1668 | SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID, true); | 1651 | SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID, true); |
1669 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 1652 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
1670 | 1653 | ||
1671 | lock (Entities) | 1654 | Entities.Add(copy); |
1672 | { | ||
1673 | Entities.Add(copy.UUID, copy); | ||
1674 | } | ||
1675 | 1655 | ||
1676 | // Since we copy from a source group that is in selected | 1656 | // Since we copy from a source group that is in selected |
1677 | // state, but the copy is shown deselected in the viewer, | 1657 | // state, but the copy is shown deselected in the viewer, |