aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs34
2 files changed, 48 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b876fc6..2a69ee1 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -423,6 +423,17 @@ namespace OpenSim.Region.Framework.Scenes
423 private int landMS; 423 private int landMS;
424 private int spareMS; 424 private int spareMS;
425 425
426 // A temporary configuration flag to enable using FireAndForget to process
427 // collisions from the physics engine. There is a problem with collisions
428 // stopping sometimes and MB's suspicion is some race condition passing
429 // collisions from the physics engine callback to the script engine.
430 // This causes the collision events to be passed with a FireAndForget
431 // call which should eliminate that linkage. Testers can turn this on
432 // and see if collisions stop. If they don't, the problem is somewhere else.
433 // This feature defaults to 'off' so, by default, the simulator operation
434 // is not changed.
435 public bool ShouldUseFireAndForgetForCollisions = false;
436
426 /// <summary> 437 /// <summary>
427 /// Tick at which the last frame was processed. 438 /// Tick at which the last frame was processed.
428 /// </summary> 439 /// </summary>
@@ -1075,8 +1086,14 @@ namespace OpenSim.Region.Framework.Scenes
1075 m_update_presences = startupConfig.GetInt("UpdateAgentsEveryNFrames", m_update_presences); 1086 m_update_presences = startupConfig.GetInt("UpdateAgentsEveryNFrames", m_update_presences);
1076 m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain); 1087 m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain);
1077 m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); 1088 m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning);
1089
1090 if (startupConfig.Contains("ShouldUseFireAndForgetForCollisions"))
1091 {
1092 ShouldUseFireAndForgetForCollisions = startupConfig.GetBoolean("ShouldUseFireAndForgetForCollisions", false);
1093 }
1078 } 1094 }
1079 1095
1096
1080 // FIXME: Ultimately this should be in a module. 1097 // FIXME: Ultimately this should be in a module.
1081 SendPeriodicAppearanceUpdates = false; 1098 SendPeriodicAppearanceUpdates = false;
1082 1099
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 781c20c..f52c9c8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -126,6 +126,8 @@ namespace OpenSim.Region.Framework.Scenes
126 126
127 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 127 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
128 128
129 private bool shouldUseFireAndForgetForCollisions = true;
130
129 /// <summary> 131 /// <summary>
130 /// Dynamic attributes can be created and deleted as required. 132 /// Dynamic attributes can be created and deleted as required.
131 /// </summary> 133 /// </summary>
@@ -2392,7 +2394,7 @@ namespace OpenSim.Region.Framework.Scenes
2392 CollidingMessage = CreateColliderArgs(this, colliders); 2394 CollidingMessage = CreateColliderArgs(this, colliders);
2393 2395
2394 if (CollidingMessage.Colliders.Count > 0) 2396 if (CollidingMessage.Colliders.Count > 0)
2395 notify(LocalId, CollidingMessage); 2397 DoNotify(notify, LocalId, CollidingMessage);
2396 2398
2397 if (PassCollisions) 2399 if (PassCollisions)
2398 sendToRoot = true; 2400 sendToRoot = true;
@@ -2406,7 +2408,7 @@ namespace OpenSim.Region.Framework.Scenes
2406 { 2408 {
2407 CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders); 2409 CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders);
2408 if (CollidingMessage.Colliders.Count > 0) 2410 if (CollidingMessage.Colliders.Count > 0)
2409 notify(ParentGroup.RootPart.LocalId, CollidingMessage); 2411 DoNotify(notify, ParentGroup.RootPart.LocalId, CollidingMessage);
2410 } 2412 }
2411 } 2413 }
2412 } 2414 }
@@ -2421,7 +2423,33 @@ namespace OpenSim.Region.Framework.Scenes
2421 colliding.Add(CreateDetObjectForGround()); 2423 colliding.Add(CreateDetObjectForGround());
2422 LandCollidingMessage.Colliders = colliding; 2424 LandCollidingMessage.Colliders = colliding;
2423 2425
2424 notify(LocalId, LandCollidingMessage); 2426 DoNotify(notify, LocalId, LandCollidingMessage);
2427 }
2428 }
2429
2430 private void DoNotify(ScriptCollidingNotification notify, uint id, ColliderArgs collargs)
2431 {
2432 if (m_parentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.ShouldUseFireAndForgetForCollisions)
2433 {
2434 // For those learning C#, FireAndForget takes a function, an object to pass
2435 // to that function and an ID string. The "oo => {}" construct is a lambda expression
2436 // for a function with one arguement ('oo'). The 'new Object[] {}" construct creates an Object
2437 // that is an object array and initializes it with three items (the parameters
2438 // being passed). The parameters passed are the function to call ('notify') and
2439 // its two arguements. Finally, once in the function (called later by the FireAndForget
2440 // thread scheduler), the passed object is cast to an object array and then each
2441 // of its items (aoo[0] to aoo[2]) are individually cast to what they are and
2442 // then used in a call of the passed ScriptCollidingNotification function.
2443 Util.FireAndForget(oo =>
2444 {
2445 Object[] aoo = (Object[])oo;
2446 ((ScriptCollidingNotification)aoo[0])((uint)aoo[1], (ColliderArgs)aoo[2]);
2447
2448 }, new Object[] { notify, id, collargs }, "SOP.Collision");
2449 }
2450 else
2451 {
2452 notify(id, collargs);
2425 } 2453 }
2426 } 2454 }
2427 2455