[Opensim-dev] SceneGraph data access refactoring

Lake, Dan dan.lake at intel.com
Thu Mar 18 23:38:11 UTC 2010


I am committing a set of patches this week which make data access and locking of presences within the scene graph more consistent. There are currently many ways to get presence data from the scene graph and/or iterate over it. To name a few, there are GetScenePresence, TryGetAvatar, GetScenePresences and ForEachScenePresence.  Unfortunately, some of these have relied on the callers locking the list or checking for null references which was missing in many places.



The patches move all locking into SceneGraph, eliminate GetScenePresence in favor of TryGetAvatar, and consolidates the two different presence iteration patterns. Instead of calling GetScenePresences() and iterating over the result, modules and other code should call ForEachScenePresence(Action<ScenePresence>) and let SceneGraph do the parallel work. Eventually this will also mean that the list does not need to be copied or locked in order to iterate since it changes infrequently but is iterated my many callers simultaneously.



The goal is to move SceneGraph toward a self-supporting container of entities with properties and a small lightweight interface for adding, removing, and performing actions on the container through the use of properties/components, filters, and delegates. Supporting or allowing a module to grab a reference to the internal array of presences and lock it so that no other thread may add/remove/iterate is seriously limiting scalability and has introduced reliability issues and races between the scene and some modules.



Dan lake

Intel Labs

dan.lake at intel.com<mailto:dan.lake at intel.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20100318/4535aa3f/attachment-0001.html>


More information about the Opensim-dev mailing list