diff options
author | John Hurliman | 2010-09-10 12:04:12 -0700 |
---|---|---|
committer | John Hurliman | 2010-09-10 12:04:12 -0700 |
commit | dd277a0d02f1aa79f4fcb5d108cbc696e90500c2 (patch) | |
tree | 7e396d347e43504ec23c59c3749f995f15c2e254 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | * Run SimianGrid session updates asynchronously instead of from the main hear... (diff) | |
download | opensim-SC_OLD-dd277a0d02f1aa79f4fcb5d108cbc696e90500c2.zip opensim-SC_OLD-dd277a0d02f1aa79f4fcb5d108cbc696e90500c2.tar.gz opensim-SC_OLD-dd277a0d02f1aa79f4fcb5d108cbc696e90500c2.tar.bz2 opensim-SC_OLD-dd277a0d02f1aa79f4fcb5d108cbc696e90500c2.tar.xz |
First pass at cleaning up thread safety in EntityManager and SceneGraph
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 82e7d76..7ce95a7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1029,29 +1029,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1029 | if (ScriptEngine) | 1029 | if (ScriptEngine) |
1030 | { | 1030 | { |
1031 | m_log.Info("Stopping all Scripts in Scene"); | 1031 | m_log.Info("Stopping all Scripts in Scene"); |
1032 | foreach (EntityBase ent in Entities) | 1032 | |
1033 | EntityBase[] entities = Entities.GetEntities(); | ||
1034 | foreach (EntityBase ent in entities) | ||
1033 | { | 1035 | { |
1034 | if (ent is SceneObjectGroup) | 1036 | if (ent is SceneObjectGroup) |
1035 | { | 1037 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); |
1036 | ((SceneObjectGroup) ent).RemoveScriptInstances(false); | ||
1037 | } | ||
1038 | } | 1038 | } |
1039 | } | 1039 | } |
1040 | else | 1040 | else |
1041 | { | 1041 | { |
1042 | m_log.Info("Starting all Scripts in Scene"); | 1042 | m_log.Info("Starting all Scripts in Scene"); |
1043 | lock (Entities) | 1043 | |
1044 | EntityBase[] entities = Entities.GetEntities(); | ||
1045 | foreach (EntityBase ent in entities) | ||
1044 | { | 1046 | { |
1045 | foreach (EntityBase ent in Entities) | 1047 | if (ent is SceneObjectGroup) |
1046 | { | 1048 | { |
1047 | if (ent is SceneObjectGroup) | 1049 | SceneObjectGroup sog = (SceneObjectGroup)ent; |
1048 | { | 1050 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
1049 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 1051 | sog.ResumeScripts(); |
1050 | ((SceneObjectGroup)ent).ResumeScripts(); | ||
1051 | } | ||
1052 | } | 1052 | } |
1053 | } | 1053 | } |
1054 | } | 1054 | } |
1055 | |||
1055 | m_scripts_enabled = !ScriptEngine; | 1056 | m_scripts_enabled = !ScriptEngine; |
1056 | m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); | 1057 | m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); |
1057 | } | 1058 | } |
@@ -1098,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1098 | shuttingdown = true; | 1099 | shuttingdown = true; |
1099 | 1100 | ||
1100 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1101 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1101 | List<EntityBase> entities = GetEntities(); | 1102 | EntityBase[] entities = GetEntities(); |
1102 | foreach (EntityBase entity in entities) | 1103 | foreach (EntityBase entity in entities) |
1103 | { | 1104 | { |
1104 | if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) | 1105 | if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) |
@@ -2037,8 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2037 | { | 2038 | { |
2038 | lock (Entities) | 2039 | lock (Entities) |
2039 | { | 2040 | { |
2040 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); | 2041 | EntityBase[] entities = Entities.GetEntities(); |
2041 | |||
2042 | foreach (EntityBase e in entities) | 2042 | foreach (EntityBase e in entities) |
2043 | { | 2043 | { |
2044 | if (e is SceneObjectGroup) | 2044 | if (e is SceneObjectGroup) |
@@ -3977,9 +3977,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3977 | /// </summary> | 3977 | /// </summary> |
3978 | public void ForceClientUpdate() | 3978 | public void ForceClientUpdate() |
3979 | { | 3979 | { |
3980 | List<EntityBase> EntityList = GetEntities(); | 3980 | EntityBase[] entityList = GetEntities(); |
3981 | 3981 | foreach (EntityBase ent in entityList) | |
3982 | foreach (EntityBase ent in EntityList) | ||
3983 | { | 3982 | { |
3984 | if (ent is SceneObjectGroup) | 3983 | if (ent is SceneObjectGroup) |
3985 | { | 3984 | { |
@@ -3997,9 +3996,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3997 | { | 3996 | { |
3998 | m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); | 3997 | m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); |
3999 | 3998 | ||
4000 | List<EntityBase> EntityList = GetEntities(); | 3999 | EntityBase[] entityList = GetEntities(); |
4001 | 4000 | foreach (EntityBase ent in entityList) | |
4002 | foreach (EntityBase ent in EntityList) | ||
4003 | { | 4001 | { |
4004 | if (ent is SceneObjectGroup) | 4002 | if (ent is SceneObjectGroup) |
4005 | { | 4003 | { |
@@ -4368,7 +4366,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4368 | /// will not affect the original list of objects in the scene. | 4366 | /// will not affect the original list of objects in the scene. |
4369 | /// </summary> | 4367 | /// </summary> |
4370 | /// <returns></returns> | 4368 | /// <returns></returns> |
4371 | public List<EntityBase> GetEntities() | 4369 | public EntityBase[] GetEntities() |
4372 | { | 4370 | { |
4373 | return m_sceneGraph.GetEntities(); | 4371 | return m_sceneGraph.GetEntities(); |
4374 | } | 4372 | } |
@@ -4402,9 +4400,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4402 | 4400 | ||
4403 | public void CleanTempObjects() | 4401 | public void CleanTempObjects() |
4404 | { | 4402 | { |
4405 | List<EntityBase> objs = GetEntities(); | 4403 | EntityBase[] entities = GetEntities(); |
4406 | 4404 | foreach (EntityBase obj in entities) | |
4407 | foreach (EntityBase obj in objs) | ||
4408 | { | 4405 | { |
4409 | if (obj is SceneObjectGroup) | 4406 | if (obj is SceneObjectGroup) |
4410 | { | 4407 | { |