Put in locks on m_killRecord to replace changed locks on m_entityUpdates.SyncRoot

These locks are necessary to avoid a delete/update race condition for scene objects.
However, since we're now locking on m_killRecord this shouldn't cause delays to m_entityUpdates reprioritization
viewer-2-initial-appearance
Justin Clark-Casey (justincc) 2010-12-15 23:11:42 +00:00
parent ed26376ec5
commit 0745d65344
1 changed files with 203 additions and 196 deletions

View File

@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
/// ownerless phantom.
///
/// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
/// All manipulation of this set has to occur under a lock
///
/// </value>
protected HashSet<uint> m_killRecord;
@ -1521,7 +1521,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_scene.GetScenePresence(localID) == null)
{
lock (m_entityUpdates.SyncRoot)
// We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
// condition where a kill can be processed before an out-of-date update for the same object.
lock (m_killRecord)
{
m_killRecord.Add(localID);
@ -3558,6 +3560,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0;
// We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
// condition where a kill can be processed before an out-of-date update for the same object.
lock (m_killRecord)
{
EntityUpdate update;
while (updatesThisCall < maxUpdates)
{
@ -3774,6 +3780,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(packet, ThrottleOutPacketType.Task, true);
}
}
#endregion Packet Sending
}