From 44d6746f406445ca0db453ede44936a683a27386 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Jan 2019 08:34:19 +0000 Subject: [PATCH] well.. put the ode locks back, for now --- OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 8 +-- .../Region/PhysicsModules/ubOde/ODEScene.cs | 60 +++++++++++-------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index c9bc754a4e..5ad2126ccd 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -124,8 +124,8 @@ namespace OpenSim.Region.PhysicsModule.ODE /// /lib/x86_64-linux-gnu/libpthread.so.0(+0xfc60) [0x7f03c9849c60] /// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82] /// -// internal static Object UniversalColliderSyncObject = new Object(); - internal static Object SimulationLock = new Object(); + internal static object UniversalColliderSyncObject = new object(); + internal static object SimulationLock = new object(); /// /// Is stats collecting enabled for this ODE scene? @@ -880,7 +880,7 @@ namespace OpenSim.Region.PhysicsModule.ODE { int count; -// lock (OdeScene.UniversalColliderSyncObject) + lock (OdeScene.UniversalColliderSyncObject) { // We do this inside the lock so that we don't count any delay in acquiring it if (CollectStats) @@ -2869,7 +2869,7 @@ namespace OpenSim.Region.PhysicsModule.ODE tempTick = tempTick2; } -// lock(SimulationLock) + lock(SimulationLock) SafeNativeMethods.WorldQuickStep(world, ODE_STEPSIZE); if (CollectStats) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index b53bedadb2..bff459886c 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -282,7 +282,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public IntPtr GroundSpace; // space for ground public object OdeLock = new object(); -// public static object SimulationLock = new object(); + public static object SimulationLock = new object(); public IMesher mesher; @@ -1134,7 +1134,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying) { - OdeCharacter newAv = new OdeCharacter(localID, avName, this, position, + OdeCharacter newAv = new OdeCharacter(localID, avName, this, position, size, feetOffset, avDensity, avMovementDivisorWalk, avMovementDivisorRun); newAv.Flying = isFlying; newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; @@ -1214,7 +1214,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde OdePrim newPrim; lock (OdeLock) { - newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID); } return newPrim; @@ -1453,10 +1452,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde { try { - if (item.actor is OdeCharacter) - ((OdeCharacter)item.actor).DoAChange(item.what, item.arg); - else if (((OdePrim)item.actor).DoAChange(item.what, item.arg)) - RemovePrimThreadLocked((OdePrim)item.actor); + lock (SimulationLock) + { + if (item.actor is OdeCharacter) + ((OdeCharacter)item.actor).DoAChange(item.what, item.arg); + else if (((OdePrim)item.actor).DoAChange(item.what, item.arg)) + RemovePrimThreadLocked((OdePrim)item.actor); + } } catch { @@ -1546,10 +1548,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde { try { - if (item.actor is OdeCharacter) - ((OdeCharacter)item.actor).DoAChange(item.what, item.arg); - else if (((OdePrim)item.actor).DoAChange(item.what, item.arg)) - RemovePrimThreadLocked((OdePrim)item.actor); + lock (SimulationLock) + { + if (item.actor is OdeCharacter) + ((OdeCharacter)item.actor).DoAChange(item.what, item.arg); + else if (((OdePrim)item.actor).DoAChange(item.what, item.arg)) + RemovePrimThreadLocked((OdePrim)item.actor); + } } catch { @@ -1601,17 +1606,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde aprim.Move(); } } -// moveTime += Util.GetTimeStampMS() - tmpTime; + // moveTime += Util.GetTimeStampMS() - tmpTime; + // tmpTime = Util.GetTimeStampMS(); + lock (SimulationLock) + { + m_rayCastManager.ProcessQueuedRequests(); + // rayTime += Util.GetTimeStampMS() - tmpTime; -// tmpTime = Util.GetTimeStampMS(); - m_rayCastManager.ProcessQueuedRequests(); -// rayTime += Util.GetTimeStampMS() - tmpTime; + // tmpTime = Util.GetTimeStampMS(); + collision_optimized(); + } + // collisionTime += Util.GetTimeStampMS() - tmpTime; -// tmpTime = Util.GetTimeStampMS(); - collision_optimized(); -// collisionTime += Util.GetTimeStampMS() - tmpTime; - -// tmpTime = Util.GetTimeStampMS(); + // tmpTime = Util.GetTimeStampMS(); lock(_collisionEventPrimRemove) { foreach (PhysicsActor obj in _collisionEventPrimRemove) @@ -1650,13 +1657,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde foreach(OdePrim prm in sleepers) prm.SleeperAddCollisionEvents(); sleepers.Clear(); -// collisonRepo += Util.GetTimeStampMS() - tmpTime; + // collisonRepo += Util.GetTimeStampMS() - tmpTime; + - // do a ode simulation step -// tmpTime = Util.GetTimeStampMS(); - SafeNativeMethods.WorldQuickStep(world, ODE_STEPSIZE); - SafeNativeMethods.JointGroupEmpty(contactgroup); + // tmpTime = Util.GetTimeStampMS(); + lock (SimulationLock) + { + SafeNativeMethods.WorldQuickStep(world, ODE_STEPSIZE); + SafeNativeMethods.JointGroupEmpty(contactgroup); + } // qstepTIme += Util.GetTimeStampMS() - tmpTime; // update managed ideia of physical data and do updates to core