lock unique and uniqueReleased in same order when both locks are needed

avinationmerge
UbitUmarov 2012-11-02 10:14:08 +00:00
parent e6c8eca504
commit c2639bef8e
1 changed files with 14 additions and 20 deletions

View File

@ -1057,7 +1057,6 @@ namespace OpenSim.Region.Physics.Meshing
mesh.RefCount++; mesh.RefCount++;
return mesh; return mesh;
} }
}
// try to find a identical mesh on meshs recently released // try to find a identical mesh on meshs recently released
lock (m_uniqueReleasedMeshes) lock (m_uniqueReleasedMeshes)
@ -1066,18 +1065,16 @@ namespace OpenSim.Region.Physics.Meshing
if (mesh != null) if (mesh != null)
{ {
m_uniqueReleasedMeshes.Remove(key); m_uniqueReleasedMeshes.Remove(key);
lock (m_uniqueMeshes)
{
try try
{ {
m_uniqueMeshes.Add(key, mesh); m_uniqueMeshes.Add(key, mesh);
} }
catch { } catch { }
}
mesh.RefCount = 1; mesh.RefCount = 1;
return mesh; return mesh;
} }
} }
}
return null; return null;
} }
@ -1108,7 +1105,6 @@ namespace OpenSim.Region.Physics.Meshing
mesh.RefCount++; mesh.RefCount++;
return mesh; return mesh;
} }
}
// try to find a identical mesh on meshs recently released // try to find a identical mesh on meshs recently released
lock (m_uniqueReleasedMeshes) lock (m_uniqueReleasedMeshes)
@ -1117,18 +1113,16 @@ namespace OpenSim.Region.Physics.Meshing
if (mesh != null) if (mesh != null)
{ {
m_uniqueReleasedMeshes.Remove(key); m_uniqueReleasedMeshes.Remove(key);
lock (m_uniqueMeshes)
{
try try
{ {
m_uniqueMeshes.Add(key, mesh); m_uniqueMeshes.Add(key, mesh);
} }
catch { } catch { }
}
mesh.RefCount = 1; mesh.RefCount = 1;
return mesh; return mesh;
} }
} }
}
Mesh UnitMesh = null; Mesh UnitMesh = null;
AMeshKey unitKey = GetMeshUniqueKey(primShape, m_MeshUnitSize, (byte)lod, convex); AMeshKey unitKey = GetMeshUniqueKey(primShape, m_MeshUnitSize, (byte)lod, convex);