First pass at cleaning up thread safety in EntityManager and SceneGraph

This commit is contained in:
John Hurliman
2010-09-10 12:04:12 -07:00
parent 9609faa8eb
commit dd277a0d02
25 changed files with 252 additions and 395 deletions

View File

@@ -375,8 +375,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendNamesReply()
{
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>();
EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
foreach (EntityBase user in users)
{
SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", ""));
@@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendWhoReply()
{
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>();
EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
foreach (EntityBase user in users)
{
/*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName,
@@ -415,11 +413,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendReplyUsers()
{
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>();
EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
SendServerCommand("392 :UserID Terminal Host");
if (users.Count == 0)
if (users.Length == 0)
{
SendServerCommand("395 :Nobody logged in");
return;

View File

@@ -111,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
}
// Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList)
public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList)
{
System.Collections.ArrayList missingList = new System.Collections.ArrayList();
SceneObjectGroup temp = null;

View File

@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// </summary>
public void FindDifferences()
{
System.Collections.Generic.List<EntityBase> sceneEntityList = m_Entity.Scene.GetEntities();
List<EntityBase> sceneEntityList = new List<EntityBase>(m_Entity.Scene.GetEntities());
DiffersFromSceneGroup = false;
// if group is not contained in scene's list
if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))

View File

@@ -41,12 +41,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
private readonly Scene m_scene;
private readonly IEnumerator<EntityBase> m_sogEnum;
private readonly ISecurityCredential m_security;
private readonly List<EntityBase> m_entities;
public IObjEnum(Scene scene, ISecurityCredential security)
{
m_scene = scene;
m_security = security;
m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator();
m_entities = new List<EntityBase>(m_scene.Entities.GetEntities());
m_sogEnum = m_entities.GetEnumerator();
}
public void Dispose()

View File

@@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
get
{
List<EntityBase> ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
IAvatar[] rets = new IAvatar[ents.Count];
EntityBase[] ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
IAvatar[] rets = new IAvatar[ents.Length];
for (int i = 0; i < ents.Count; i++)
for (int i = 0; i < ents.Length; i++)
{
EntityBase ent = ents[i];
rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security);

View File

@@ -568,8 +568,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
{
m_copse = new List<Copse>();
List<EntityBase> objs = m_scene.GetEntities();
EntityBase[] objs = m_scene.GetEntities();
foreach (EntityBase obj in objs)
{
if (obj is SceneObjectGroup)