From b08ab1e3754da4a2855bb77fca91dce01e9c2fae Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 23:31:45 +0100 Subject: If BulletSim is running on its own threads, start this thread via the thread watchdog. This allows us to see the presence of the permanent thread via the "show threads" console comand. Also adds the region name to the thread name. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index f7317c0..d3b2ad7 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -32,6 +32,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading; using OpenSim.Framework; +using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging; @@ -286,9 +287,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters if (BSParam.UseSeparatePhysicsThread) { // The physics simulation should happen independently of the heartbeat loop - m_physicsThread = new Thread(BulletSPluginPhysicsThread); - m_physicsThread.Name = BulletEngineName; - m_physicsThread.Start(); + m_physicsThread + = Watchdog.StartThread( + BulletSPluginPhysicsThread, + string.Format("{0} ({1})", BulletEngineName, RegionName), + ThreadPriority.Normal, + true, + false); } } -- cgit v1.1 From 29400538b7bb9505ab2873d90680d9ad4cb101d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 23:37:20 +0100 Subject: minor: fix indenting from previous commit b08ab1e --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index d3b2ad7..f87c6c4 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -287,13 +287,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters if (BSParam.UseSeparatePhysicsThread) { // The physics simulation should happen independently of the heartbeat loop - m_physicsThread - = Watchdog.StartThread( - BulletSPluginPhysicsThread, - string.Format("{0} ({1})", BulletEngineName, RegionName), - ThreadPriority.Normal, - true, - false); + m_physicsThread + = Watchdog.StartThread( + BulletSPluginPhysicsThread, + string.Format("{0} ({1})", BulletEngineName, RegionName), + ThreadPriority.Normal, + true, + false); } } -- cgit v1.1 From 6e6512eb4a9fb9fb88d5ec7f3968598f3012b356 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 23:43:59 +0100 Subject: Make bulletsim thread alarm if no update for 5 seconds. The cost is minimal (also done for scene loop) at the benefit of telling us if this thread simply stops for some reason. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index f87c6c4..338593f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -293,7 +293,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters string.Format("{0} ({1})", BulletEngineName, RegionName), ThreadPriority.Normal, true, - false); + true); } } @@ -861,6 +861,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // TODO. DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); } + + if (BSParam.UseSeparatePhysicsThread) + Watchdog.UpdateThread(); } } -- cgit v1.1 From 4b04d22899e954831c4bf0904b5c2d9adacf650a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Sep 2014 23:53:04 +0100 Subject: Don't need to check separate physics status in bulletsim update since that method is only run for an indepndent thread anyway. Also remove bulletsim monitored thread from watchdog on shutdown. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 338593f..a46c241 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -862,9 +862,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); } - if (BSParam.UseSeparatePhysicsThread) - Watchdog.UpdateThread(); + Watchdog.UpdateThread(); } + + Watchdog.RemoveThread(); } #endregion // Simulation -- cgit v1.1