XEngine: fix collisions, add event coalescing for collision events.

Fix a nasty concurrency issue that could cause a high event frequency
to start more than one thread pool job for a single script.
This commit is contained in:
Melanie Thielker
2008-09-18 18:50:39 +00:00
parent e6f3181d3a
commit 903fbd1f06
3 changed files with 171 additions and 142 deletions

View File

@@ -198,10 +198,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det.Add(d);
}
myScriptEngine.PostObjectEvent(localID, new EventParams(
"collision_start",
new Object[] { new LSL_Types.LSLInteger(1) },
det.ToArray()));
if (det.Count > 0)
myScriptEngine.PostObjectEvent(localID, new EventParams(
"collision_start",
new Object[] { new LSL_Types.LSLInteger(det.Count) },
det.ToArray()));
}
public void collision(uint localID, ColliderArgs col)
@@ -217,9 +218,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det.Add(d);
}
myScriptEngine.PostObjectEvent(localID, new EventParams(
"collision", new Object[] { new LSL_Types.LSLInteger(1) },
det.ToArray()));
if (det.Count > 0)
myScriptEngine.PostObjectEvent(localID, new EventParams(
"collision", new Object[] { new LSL_Types.LSLInteger(det.Count) },
det.ToArray()));
}
public void collision_end(uint localID, ColliderArgs col)
@@ -235,10 +237,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det.Add(d);
}
myScriptEngine.PostObjectEvent(localID, new EventParams(
"collision_end",
new Object[] { new LSL_Types.LSLInteger(1) },
det.ToArray()));
if (det.Count > 0)
myScriptEngine.PostObjectEvent(localID, new EventParams(
"collision_end",
new Object[] { new LSL_Types.LSLInteger(det.Count) },
det.ToArray()));
}
public void land_collision_start(uint localID, UUID itemID)