From b72045495031f97eeaf69b3ed4a03db73828c2b2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 29 Oct 2011 02:42:53 +0100 Subject: [PATCH] Remove the SyncRoot locking from Scene which was only being done around the main physics loop and ScenePresence position and velocity setting This is no longer necessary with ODECharacter taints (ODEPrim was already not taking part in this). BSCharacter was already tainting. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 38 ++++++++----------- .../Region/Framework/Scenes/ScenePresence.cs | 6 +-- 3 files changed, 18 insertions(+), 32 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3621077353..b1225d5db5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -509,12 +509,6 @@ namespace OpenSim.Region.Framework.Scenes } } - // This gets locked so things stay thread safe. - public object SyncRoot - { - get { return m_sceneGraph.m_syncRoot; } - } - public string DefaultScriptEngine { get { return m_defaultScriptEngine; } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 542bd51274..1af18e7309 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -84,8 +84,6 @@ namespace OpenSim.Region.Framework.Scenes protected int m_activeScripts = 0; protected int m_scriptLPS = 0; - protected internal object m_syncRoot = new object(); - protected internal PhysicsScene _PhyScene; /// @@ -187,26 +185,22 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal float UpdatePhysics(double elapsed) { - lock (m_syncRoot) - { - // Here is where the Scene calls the PhysicsScene. This is a one-way - // interaction; the PhysicsScene cannot access the calling Scene directly. - // But with joints, we want a PhysicsActor to be able to influence a - // non-physics SceneObjectPart. In particular, a PhysicsActor that is connected - // with a joint should be able to move the SceneObjectPart which is the visual - // representation of that joint (for editing and serialization purposes). - // However the PhysicsActor normally cannot directly influence anything outside - // of the PhysicsScene, and the non-physical SceneObjectPart which represents - // the joint in the Scene does not exist in the PhysicsScene. - // - // To solve this, we have an event in the PhysicsScene that is fired when a joint - // has changed position (because one of its associated PhysicsActors has changed - // position). - // - // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). - - return _PhyScene.Simulate((float)elapsed); - } + // Here is where the Scene calls the PhysicsScene. This is a one-way + // interaction; the PhysicsScene cannot access the calling Scene directly. + // But with joints, we want a PhysicsActor to be able to influence a + // non-physics SceneObjectPart. In particular, a PhysicsActor that is connected + // with a joint should be able to move the SceneObjectPart which is the visual + // representation of that joint (for editing and serialization purposes). + // However the PhysicsActor normally cannot directly influence anything outside + // of the PhysicsScene, and the non-physical SceneObjectPart which represents + // the joint in the Scene does not exist in the PhysicsScene. + // + // To solve this, we have an event in the PhysicsScene that is fired when a joint + // has changed position (because one of its associated PhysicsActors has changed + // position). + // + // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). + return _PhyScene.Simulate((float)elapsed); } protected internal void UpdateScenePresenceMovement() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 15c18c6608..2a18046591 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -515,8 +515,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - lock (m_scene.SyncRoot) - m_physicsActor.Position = value; + m_physicsActor.Position = value; } catch (Exception e) { @@ -568,8 +567,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - lock (m_scene.SyncRoot) - actor.Velocity = value; + actor.Velocity = value; } catch (Exception e) {