From cfdccdd71c21fa48ec5b2f8fd42f57d2cb39b1ef Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 14 Dec 2011 18:03:25 +0000 Subject: [PATCH] Eliminate _taintedPrimsH and _taintedPrimsL (and _taintedPrimLock) in favour of just a _taintedPrims HashSet. There's no point maintaining a list because any pending taint operations are all carried out in the same call anyway. --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 59 +++++--------------- 1 file changed, 14 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 21b3fbd203..0cc040c892 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -205,27 +205,9 @@ namespace OpenSim.Region.Physics.OdePlugin private readonly HashSet _activeprims = new HashSet(); /// - /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH + /// Prims that the simulator has created/deleted/updated and so need updating in ODE. /// - private readonly Object _taintedPrimLock = new Object(); - - /// - /// List of tainted prims. - /// - /// - /// A tainted prim is one that has taints to process before performing any other operations. The list is - /// cleared after processing. - /// - private readonly List _taintedPrimL = new List(); - - /// - /// HashSet of tainted prims. - /// - /// - /// A tainted prim is one that has taints to process before performing any other operations. The hashset is - /// cleared after processing. - /// - private readonly HashSet _taintedPrimH = new HashSet(); + private readonly HashSet _taintedPrims = new HashSet(); /// /// Record a character that has taints to be processed. @@ -764,7 +746,7 @@ namespace OpenSim.Region.Physics.OdePlugin } catch (AccessViolationException) { - m_log.Warn("[ODE SCENE]: Unable to collide test a space"); + m_log.Error("[ODE SCENE]: Unable to collide test a space"); return; } //Colliding a space or a geom with a space or a geom. so drill down @@ -826,7 +808,7 @@ namespace OpenSim.Region.Physics.OdePlugin } catch (Exception e) { - m_log.WarnFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message); + m_log.ErrorFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message); return; } @@ -1551,7 +1533,7 @@ namespace OpenSim.Region.Physics.OdePlugin } catch (AccessViolationException) { - m_log.WarnFormat("[ODE SCENE]: Unable to space collide {0}", Name); + m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name); } //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); @@ -1582,13 +1564,14 @@ namespace OpenSim.Region.Physics.OdePlugin removeprims = new List(); } removeprims.Add(chr); - m_log.Debug("[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); + m_log.Error( + "[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); } } } catch (AccessViolationException) { - m_log.Warn("[ODE SCENE]: Unable to space collide"); + m_log.Error("[ODE SCENE]: Unable to space collide"); } } } @@ -2623,17 +2606,8 @@ namespace OpenSim.Region.Physics.OdePlugin if (actor is OdePrim) { OdePrim taintedprim = ((OdePrim)actor); - lock (_taintedPrimLock) - { - if (!(_taintedPrimH.Contains(taintedprim))) - { -#if SPAM -Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); -#endif - _taintedPrimH.Add(taintedprim); // HashSet for searching - _taintedPrimL.Add(taintedprim); // List for ordered readout - } - } + lock (_taintedPrims) + _taintedPrims.Add(taintedprim); } else if (actor is OdeCharacter) { @@ -2736,9 +2710,9 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); } } - lock (_taintedPrimLock) + lock (_taintedPrims) { - foreach (OdePrim prim in _taintedPrimL) + foreach (OdePrim prim in _taintedPrims) { if (prim.m_taintremove) { @@ -2763,12 +2737,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); if (SupportsNINJAJoints) SimulatePendingNINJAJoints(); - if (_taintedPrimL.Count > 0) - { -//Console.WriteLine("Simulate calls Clear of _taintedPrim list"); - _taintedPrimH.Clear(); - _taintedPrimL.Clear(); - } + _taintedPrims.Clear(); } // Move characters @@ -2843,7 +2812,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); foreach (OdeCharacter actor in _characters) { if (actor.bad) - m_log.WarnFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); + m_log.ErrorFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); actor.UpdatePositionAndVelocity(defects); }