diff options
author | John Hurliman | 2009-10-06 15:54:00 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-06 15:54:00 -0700 |
commit | 832cc685138b2244529f10b54b373c34adb4a633 (patch) | |
tree | 888cf05d2d0bacdd8acec47150075423d07ed3ee /OpenSim/Region/Framework/Scenes | |
parent | Checks the number of ThreadPool and IOCP threads on startup and bumps up the ... (diff) | |
parent | Rewrote parts of the code that were double-locking different objects. This is... (diff) | |
download | opensim-SC_OLD-832cc685138b2244529f10b54b373c34adb4a633.zip opensim-SC_OLD-832cc685138b2244529f10b54b373c34adb4a633.tar.gz opensim-SC_OLD-832cc685138b2244529f10b54b373c34adb4a633.tar.bz2 opensim-SC_OLD-832cc685138b2244529f10b54b373c34adb4a633.tar.xz |
Merging in diva's locking fixes
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | 36 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 36 |
2 files changed, 43 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 5b571c7..df9473d 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -122,12 +122,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
122 | public bool InventoryDeQueueAndDelete() | 122 | public bool InventoryDeQueueAndDelete() |
123 | { | 123 | { |
124 | DeleteToInventoryHolder x = null; | 124 | DeleteToInventoryHolder x = null; |
125 | int left = 0; | ||
125 | 126 | ||
126 | try | 127 | try |
127 | { | 128 | { |
128 | lock (m_inventoryDeletes) | 129 | lock (m_inventoryDeletes) |
129 | { | 130 | { |
130 | int left = m_inventoryDeletes.Count; | 131 | left = m_inventoryDeletes.Count; |
131 | if (left > 0) | 132 | if (left > 0) |
132 | { | 133 | { |
133 | x = m_inventoryDeletes.Dequeue(); | 134 | x = m_inventoryDeletes.Dequeue(); |
@@ -136,23 +137,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
136 | m_inventoryDeletes.Enqueue(x); | 137 | m_inventoryDeletes.Enqueue(x); |
137 | return true; | 138 | return true; |
138 | } | 139 | } |
140 | } | ||
141 | } | ||
139 | 142 | ||
140 | m_log.DebugFormat( | 143 | if (left > 0) |
141 | "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); | 144 | { |
142 | 145 | m_log.DebugFormat( | |
143 | try | 146 | "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); |
144 | { | 147 | |
145 | m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); | 148 | try |
146 | if (x.permissionToDelete) | 149 | { |
147 | m_scene.DeleteSceneObject(x.objectGroup, false); | 150 | m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); |
148 | } | 151 | if (x.permissionToDelete) |
149 | catch (Exception e) | 152 | m_scene.DeleteSceneObject(x.objectGroup, false); |
150 | { | 153 | } |
151 | m_log.DebugFormat("Exception background sending object: " + e); | 154 | catch (Exception e) |
152 | } | 155 | { |
153 | 156 | m_log.DebugFormat("Exception background sending object: " + e); | |
154 | return true; | ||
155 | } | 157 | } |
158 | |||
159 | return true; | ||
156 | } | 160 | } |
157 | } | 161 | } |
158 | catch (Exception e) | 162 | catch (Exception e) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 54ac792..20b3b5c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -297,34 +297,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
297 | 297 | ||
298 | sceneObject.AttachToScene(m_parentScene); | 298 | sceneObject.AttachToScene(m_parentScene); |
299 | 299 | ||
300 | List<SceneObjectPart> parts = null; | ||
301 | bool found = false; | ||
300 | lock (sceneObject) | 302 | lock (sceneObject) |
301 | { | 303 | { |
302 | if (!Entities.ContainsKey(sceneObject.UUID)) | 304 | if (!Entities.ContainsKey(sceneObject.UUID)) |
303 | { | 305 | { |
306 | found = true; | ||
304 | Entities.Add(sceneObject); | 307 | Entities.Add(sceneObject); |
305 | m_numPrim += sceneObject.Children.Count; | 308 | m_numPrim += sceneObject.Children.Count; |
306 | 309 | ||
307 | if (attachToBackup) | 310 | if (attachToBackup) |
308 | sceneObject.AttachToBackup(); | 311 | sceneObject.AttachToBackup(); |
309 | 312 | ||
310 | if (OnObjectCreate != null) | 313 | parts = new List<SceneObjectPart>(sceneObject.Children.Values); |
311 | OnObjectCreate(sceneObject); | 314 | |
312 | 315 | } | |
313 | lock (m_dictionary_lock) | 316 | } |
317 | |||
318 | if (found) | ||
319 | { | ||
320 | lock (m_dictionary_lock) | ||
321 | { | ||
322 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | ||
323 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | ||
324 | foreach (SceneObjectPart part in parts) | ||
314 | { | 325 | { |
315 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 326 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; |
316 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | 327 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; |
317 | foreach (SceneObjectPart part in sceneObject.Children.Values) | ||
318 | { | ||
319 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; | ||
320 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | ||
321 | } | ||
322 | } | 328 | } |
323 | |||
324 | return true; | ||
325 | } | 329 | } |
330 | |||
331 | if (OnObjectCreate != null) | ||
332 | OnObjectCreate(sceneObject); | ||
333 | |||
334 | return true; | ||
326 | } | 335 | } |
327 | 336 | ||
337 | |||
328 | return false; | 338 | return false; |
329 | } | 339 | } |
330 | 340 | ||