Lock updates out while linking and unlinking

avinationmerge
Melanie 2009-12-06 00:25:04 +00:00
parent ceccfe02d0
commit fbefa8273b
1 changed files with 146 additions and 133 deletions

View File

@ -26,6 +26,7 @@
*/
using System;
using System.Threading;
using System.Collections.Generic;
using System.Reflection;
using OpenMetaverse;
@ -96,6 +97,8 @@ namespace OpenSim.Region.Framework.Scenes
protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
private readonly Object m_dictionary_lock = new Object();
private Object m_updateLock = new Object();
#endregion
protected internal SceneGraph(Scene parent, RegionInfo regInfo)
@ -369,6 +372,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
protected internal void UpdateObjectGroups()
{
if (!Monitor.TryEnter(m_updateLock))
return;
List<SceneObjectGroup> updates;
// Some updates add more updates to the updateList.
@ -395,6 +401,7 @@ namespace OpenSim.Region.Framework.Scenes
"[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
}
}
Monitor.Exit(m_updateLock);
}
protected internal void AddPhysicalPrim(int number)
@ -1554,6 +1561,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="parentPrim"></param>
/// <param name="childPrims"></param>
protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
{
lock (m_updateLock)
{
SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId);
@ -1608,6 +1617,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
/// <summary>
/// Delink a linkset
@ -1619,6 +1629,8 @@ namespace OpenSim.Region.Framework.Scenes
}
protected internal void DelinkObjects(List<uint> primIds, bool sendEvents)
{
lock (m_updateLock)
{
List<SceneObjectPart> childParts = new List<SceneObjectPart>();
List<SceneObjectPart> rootParts = new List<SceneObjectPart>();
@ -1725,6 +1737,7 @@ namespace OpenSim.Region.Framework.Scenes
g.ScheduleGroupForFullUpdate();
}
}
}
protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID)
{