diff options
author | UbitUmarov | 2012-11-02 10:14:08 +0000 |
---|---|---|
committer | UbitUmarov | 2012-11-02 10:14:08 +0000 |
commit | c2639bef8e981e49fef09dfd9c54442ba500e9d4 (patch) | |
tree | c070cfbaaf0e0429dc74e7268279461f1fbdd46e /OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs | |
parent | Merge branch 'avination' into ubitwork (diff) | |
download | opensim-SC-c2639bef8e981e49fef09dfd9c54442ba500e9d4.zip opensim-SC-c2639bef8e981e49fef09dfd9c54442ba500e9d4.tar.gz opensim-SC-c2639bef8e981e49fef09dfd9c54442ba500e9d4.tar.bz2 opensim-SC-c2639bef8e981e49fef09dfd9c54442ba500e9d4.tar.xz |
lock unique and uniqueReleased in same order when both locks are needed
Diffstat (limited to 'OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs index 29fdda4..6e1a105 100644 --- a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs | |||
@@ -1057,25 +1057,22 @@ namespace OpenSim.Region.Physics.Meshing | |||
1057 | mesh.RefCount++; | 1057 | mesh.RefCount++; |
1058 | return mesh; | 1058 | return mesh; |
1059 | } | 1059 | } |
1060 | } | ||
1061 | 1060 | ||
1062 | // try to find a identical mesh on meshs recently released | 1061 | // try to find a identical mesh on meshs recently released |
1063 | lock (m_uniqueReleasedMeshes) | 1062 | lock (m_uniqueReleasedMeshes) |
1064 | { | ||
1065 | m_uniqueReleasedMeshes.TryGetValue(key, out mesh); | ||
1066 | if (mesh != null) | ||
1067 | { | 1063 | { |
1068 | m_uniqueReleasedMeshes.Remove(key); | 1064 | m_uniqueReleasedMeshes.TryGetValue(key, out mesh); |
1069 | lock (m_uniqueMeshes) | 1065 | if (mesh != null) |
1070 | { | 1066 | { |
1067 | m_uniqueReleasedMeshes.Remove(key); | ||
1071 | try | 1068 | try |
1072 | { | 1069 | { |
1073 | m_uniqueMeshes.Add(key, mesh); | 1070 | m_uniqueMeshes.Add(key, mesh); |
1074 | } | 1071 | } |
1075 | catch { } | 1072 | catch { } |
1073 | mesh.RefCount = 1; | ||
1074 | return mesh; | ||
1076 | } | 1075 | } |
1077 | mesh.RefCount = 1; | ||
1078 | return mesh; | ||
1079 | } | 1076 | } |
1080 | } | 1077 | } |
1081 | return null; | 1078 | return null; |
@@ -1108,25 +1105,22 @@ namespace OpenSim.Region.Physics.Meshing | |||
1108 | mesh.RefCount++; | 1105 | mesh.RefCount++; |
1109 | return mesh; | 1106 | return mesh; |
1110 | } | 1107 | } |
1111 | } | ||
1112 | 1108 | ||
1113 | // try to find a identical mesh on meshs recently released | 1109 | // try to find a identical mesh on meshs recently released |
1114 | lock (m_uniqueReleasedMeshes) | 1110 | lock (m_uniqueReleasedMeshes) |
1115 | { | ||
1116 | m_uniqueReleasedMeshes.TryGetValue(key, out mesh); | ||
1117 | if (mesh != null) | ||
1118 | { | 1111 | { |
1119 | m_uniqueReleasedMeshes.Remove(key); | 1112 | m_uniqueReleasedMeshes.TryGetValue(key, out mesh); |
1120 | lock (m_uniqueMeshes) | 1113 | if (mesh != null) |
1121 | { | 1114 | { |
1115 | m_uniqueReleasedMeshes.Remove(key); | ||
1122 | try | 1116 | try |
1123 | { | 1117 | { |
1124 | m_uniqueMeshes.Add(key, mesh); | 1118 | m_uniqueMeshes.Add(key, mesh); |
1125 | } | 1119 | } |
1126 | catch { } | 1120 | catch { } |
1121 | mesh.RefCount = 1; | ||
1122 | return mesh; | ||
1127 | } | 1123 | } |
1128 | mesh.RefCount = 1; | ||
1129 | return mesh; | ||
1130 | } | 1124 | } |
1131 | } | 1125 | } |
1132 | 1126 | ||