aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs38
1 files changed, 30 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index b7030f1..80d7598 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -156,10 +156,10 @@ namespace OpenSim.Region.Physics.OdePlugin
156 156
157 private const uint m_regionWidth = Constants.RegionSize; 157 private const uint m_regionWidth = Constants.RegionSize;
158 private const uint m_regionHeight = Constants.RegionSize; 158 private const uint m_regionHeight = Constants.RegionSize;
159 159 private bool IsLocked = false;
160 private float ODE_STEPSIZE = 0.020f; 160 private float ODE_STEPSIZE = 0.020f;
161 private float metersInSpace = 29.9f; 161 private float metersInSpace = 29.9f;
162 162 private List<PhysicsActor> RemoveQueue;
163 public float gravityx = 0f; 163 public float gravityx = 0f;
164 public float gravityy = 0f; 164 public float gravityy = 0f;
165 public float gravityz = -9.8f; 165 public float gravityz = -9.8f;
@@ -376,6 +376,7 @@ namespace OpenSim.Region.Physics.OdePlugin
376 // Initialize the mesh plugin 376 // Initialize the mesh plugin
377 public override void Initialise(IMesher meshmerizer, IConfigSource config) 377 public override void Initialise(IMesher meshmerizer, IConfigSource config)
378 { 378 {
379 RemoveQueue = new List<PhysicsActor>();
379 mesher = meshmerizer; 380 mesher = meshmerizer;
380 m_config = config; 381 m_config = config;
381 // Defaults 382 // Defaults
@@ -2047,13 +2048,21 @@ namespace OpenSim.Region.Physics.OdePlugin
2047 { 2048 {
2048 if (prim is OdePrim) 2049 if (prim is OdePrim)
2049 { 2050 {
2050 lock (OdeLock) 2051 if (!IsLocked) //Fix a deadlock situation.. have we been locked by Simulate?
2051 { 2052 {
2052 OdePrim p = (OdePrim) prim; 2053 lock (OdeLock)
2054 {
2055 OdePrim p = (OdePrim)prim;
2053 2056
2054 p.setPrimForRemoval(); 2057 p.setPrimForRemoval();
2055 AddPhysicsActorTaint(prim); 2058 AddPhysicsActorTaint(prim);
2056 //RemovePrimThreadLocked(p); 2059 //RemovePrimThreadLocked(p);
2060 }
2061 }
2062 else
2063 {
2064 //Add the prim to a queue which will be removed when Simulate has finished what it's doing.
2065 RemoveQueue.Add(prim);
2057 } 2066 }
2058 } 2067 }
2059 } 2068 }
@@ -2575,7 +2584,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2575 DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks 2584 DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2576 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks 2585 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2577 } 2586 }
2578 2587 IsLocked = true;
2579 lock (OdeLock) 2588 lock (OdeLock)
2580 { 2589 {
2581 // Process 10 frames if the sim is running normal.. 2590 // Process 10 frames if the sim is running normal..
@@ -2988,6 +2997,19 @@ namespace OpenSim.Region.Physics.OdePlugin
2988 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); 2997 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
2989 } 2998 }
2990 } 2999 }
3000 IsLocked = false;
3001 if (RemoveQueue.Count > 0)
3002 {
3003 do
3004 {
3005 if (RemoveQueue[0] != null)
3006 {
3007 RemovePrimThreadLocked((OdePrim)RemoveQueue[0]);
3008 }
3009 RemoveQueue.RemoveAt(0);
3010 }
3011 while (RemoveQueue.Count > 0);
3012 }
2991 3013
2992 return fps; 3014 return fps;
2993 } 3015 }