remove unnecessary lock

LSLKeyTest
UbitUmarov 2016-08-22 07:32:12 +01:00
parent 2d4d1adb4d
commit 3abd54082f
1 changed files with 21 additions and 31 deletions

View File

@ -122,8 +122,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private float m_buoyancy = 0f; private float m_buoyancy = 0f;
private bool m_freemove = false; private bool m_freemove = false;
// private CollisionLocker ode;
// private string m_name = String.Empty; // private string m_name = String.Empty;
// other filter control // other filter control
int m_colliderfilter = 0; int m_colliderfilter = 0;
@ -1571,11 +1570,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
if (CollisionEventsThisFrame != null) if (CollisionEventsThisFrame != null)
{ {
lock (CollisionEventsThisFrame) CollisionEventsThisFrame.Clear();
{ CollisionEventsThisFrame = null;
CollisionEventsThisFrame.Clear();
CollisionEventsThisFrame = null;
}
} }
m_eventsubscription = 0; m_eventsubscription = 0;
_parent_scene.RemoveCollisionEventReporting(this); _parent_scene.RemoveCollisionEventReporting(this);
@ -1585,11 +1581,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
if (CollisionEventsThisFrame == null) if (CollisionEventsThisFrame == null)
CollisionEventsThisFrame = new CollisionEventUpdate(); CollisionEventsThisFrame = new CollisionEventUpdate();
lock (CollisionEventsThisFrame) CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
{ _parent_scene.AddCollisionEventReporting(this);
CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
_parent_scene.AddCollisionEventReporting(this);
}
} }
public void SendCollisions(int timestep) public void SendCollisions(int timestep)
@ -1600,28 +1593,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (CollisionEventsThisFrame == null) if (CollisionEventsThisFrame == null)
return; return;
lock (CollisionEventsThisFrame) if (m_cureventsubscription < m_eventsubscription)
return;
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
if (!SentEmptyCollisionsEvent || ncolisions > 0)
{ {
if (m_cureventsubscription < m_eventsubscription) base.SendCollisionUpdate(CollisionEventsThisFrame);
return; m_cureventsubscription = 0;
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; if (ncolisions == 0)
if (!SentEmptyCollisionsEvent || ncolisions > 0)
{ {
base.SendCollisionUpdate(CollisionEventsThisFrame); SentEmptyCollisionsEvent = true;
m_cureventsubscription = 0; // _parent_scene.RemoveCollisionEventReporting(this);
}
if (ncolisions == 0) else
{ {
SentEmptyCollisionsEvent = true; SentEmptyCollisionsEvent = false;
// _parent_scene.RemoveCollisionEventReporting(this); CollisionEventsThisFrame.Clear();
}
else
{
SentEmptyCollisionsEvent = false;
CollisionEventsThisFrame.Clear();
}
} }
} }
} }