ubOde: add threading related calls new ode.dll may need. Hope this doesn't break with current linux ode library

LSLKeyTest
UbitUmarov 2015-11-20 00:37:41 +00:00
parent 0c93159297
commit 98a00cbce5
2 changed files with 23 additions and 4 deletions

View File

@ -466,6 +466,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
lock (_parent_scene.OdeLock) lock (_parent_scene.OdeLock)
{ {
d.AllocateODEDataForThread(0);
d.Vector3 dtmp; d.Vector3 dtmp;
if (!childPrim && Body != IntPtr.Zero) if (!childPrim && Body != IntPtr.Zero)
{ {
@ -892,9 +894,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
_velocity.Y = 0; _velocity.Y = 0;
_velocity.Z = 0; _velocity.Z = 0;
d.AllocateODEDataForThread(0);
m_lastVelocity = _velocity; m_lastVelocity = _velocity;
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
m_vehicle.Stop(); m_vehicle.Stop();
if(Body != IntPtr.Zero) if(Body != IntPtr.Zero)
d.BodySetLinearVel(Body, 0, 0, 0); // stop it d.BodySetLinearVel(Body, 0, 0, 0); // stop it

View File

@ -366,7 +366,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
/// </summary> /// </summary>
private void Initialization() private void Initialization()
{ {
// checkThread(); d.AllocateODEDataForThread(~0U);
SimulationLock = new Object(); SimulationLock = new Object();
nearCallback = near; nearCallback = near;
@ -1290,7 +1291,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public override void RemoveAvatar(PhysicsActor actor) public override void RemoveAvatar(PhysicsActor actor)
{ {
//m_log.Debug("[PHYSICS]:ODELOCK"); //m_log.Debug("[PHYSICS]:ODELOCK");
((OdeCharacter) actor).Destroy(); lock (OdeLock)
{
d.AllocateODEDataForThread(0);
((OdeCharacter) actor).Destroy();
}
} }
@ -1319,6 +1324,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
OdePrim newPrim; OdePrim newPrim;
lock (OdeLock) lock (OdeLock)
{ {
newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID); newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID);
lock (_prims) lock (_prims)
_prims.Add(newPrim); _prims.Add(newPrim);
@ -1547,6 +1553,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
return; return;
} }
d.AllocateODEDataForThread(~0U);
ODEchangeitem item; ODEchangeitem item;
int donechanges = 0; int donechanges = 0;
@ -1630,7 +1638,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
int changestimeMS = 0; int changestimeMS = 0;
int maxChangestime = (int)(reqTimeStep * 500f); // half the time int maxChangestime = (int)(reqTimeStep * 500f); // half the time
int maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time int maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
d.AllocateODEDataForThread(~0U);
if (ChangesQueue.Count > 0) if (ChangesQueue.Count > 0)
{ {
while (ChangesQueue.Dequeue(out item)) while (ChangesQueue.Dequeue(out item))
@ -2260,6 +2270,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
lock (OdeLock) lock (OdeLock)
{ {
d.AllocateODEDataForThread(~0U);
IntPtr GroundGeom = IntPtr.Zero; IntPtr GroundGeom = IntPtr.Zero;
if (RegionTerrain.TryGetValue(pOffset, out GroundGeom)) if (RegionTerrain.TryGetValue(pOffset, out GroundGeom))
{ {
@ -2450,9 +2462,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
lock (OdeLock) lock (OdeLock)
{ {
if (world == IntPtr.Zero) if (world == IntPtr.Zero)
return; return;
d.AllocateODEDataForThread(~0U);
if (m_meshWorker != null) if (m_meshWorker != null)
m_meshWorker.Stop(); m_meshWorker.Stop();