diff options
author | UbitUmarov | 2017-05-13 16:34:29 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-13 16:34:29 +0100 |
commit | 16f02cb6fd57c5ad015b1c9e5edd17a4dbed37ef (patch) | |
tree | 02228429f2714522ff3b1fbb104f5a31639db5c6 /OpenSim | |
parent | fix wrong locking on unused path it case it does get uses. Thanks LaNani Sundara (diff) | |
download | opensim-SC_OLD-16f02cb6fd57c5ad015b1c9e5edd17a4dbed37ef.zip opensim-SC_OLD-16f02cb6fd57c5ad015b1c9e5edd17a4dbed37ef.tar.gz opensim-SC_OLD-16f02cb6fd57c5ad015b1c9e5edd17a4dbed37ef.tar.bz2 opensim-SC_OLD-16f02cb6fd57c5ad015b1c9e5edd17a4dbed37ef.tar.xz |
we can't allow abort to change only one dic
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs index fe20767..816523b 100644 --- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs +++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs | |||
@@ -74,21 +74,19 @@ namespace OpenSim.Framework | |||
74 | { | 74 | { |
75 | rwLock.EnterWriteLock(); | 75 | rwLock.EnterWriteLock(); |
76 | gotLock = true; | 76 | gotLock = true; |
77 | if (Dictionary1.ContainsKey(key1)) | ||
78 | { | ||
79 | if (!Dictionary2.ContainsKey(key2)) | ||
80 | throw new ArgumentException("key1 exists in the dictionary but not key2"); | ||
81 | } | ||
82 | else if (Dictionary2.ContainsKey(key2)) | ||
83 | { | ||
84 | if (!Dictionary1.ContainsKey(key1)) | ||
85 | throw new ArgumentException("key2 exists in the dictionary but not key1"); | ||
86 | } | ||
87 | Dictionary1[key1] = value; | ||
88 | Dictionary2[key2] = value; | ||
77 | } | 89 | } |
78 | |||
79 | if (Dictionary1.ContainsKey(key1)) | ||
80 | { | ||
81 | if (!Dictionary2.ContainsKey(key2)) | ||
82 | throw new ArgumentException("key1 exists in the dictionary but not key2"); | ||
83 | } | ||
84 | else if (Dictionary2.ContainsKey(key2)) | ||
85 | { | ||
86 | if (!Dictionary1.ContainsKey(key1)) | ||
87 | throw new ArgumentException("key2 exists in the dictionary but not key1"); | ||
88 | } | ||
89 | |||
90 | Dictionary1[key1] = value; | ||
91 | Dictionary2[key2] = value; | ||
92 | } | 90 | } |
93 | finally | 91 | finally |
94 | { | 92 | { |
@@ -112,10 +110,9 @@ namespace OpenSim.Framework | |||
112 | { | 110 | { |
113 | rwLock.EnterWriteLock(); | 111 | rwLock.EnterWriteLock(); |
114 | gotLock = true; | 112 | gotLock = true; |
113 | Dictionary1.Remove(key1); | ||
114 | success = Dictionary2.Remove(key2); | ||
115 | } | 115 | } |
116 | |||
117 | Dictionary1.Remove(key1); | ||
118 | success = Dictionary2.Remove(key2); | ||
119 | } | 116 | } |
120 | finally | 117 | finally |
121 | { | 118 | { |
@@ -151,8 +148,12 @@ namespace OpenSim.Framework | |||
151 | { | 148 | { |
152 | if (kvp.Value.Equals(value)) | 149 | if (kvp.Value.Equals(value)) |
153 | { | 150 | { |
154 | Dictionary1.Remove(key1); | 151 | try { } |
155 | Dictionary2.Remove(kvp.Key); | 152 | finally |
153 | { | ||
154 | Dictionary1.Remove(key1); | ||
155 | Dictionary2.Remove(kvp.Key); | ||
156 | } | ||
156 | found = true; | 157 | found = true; |
157 | break; | 158 | break; |
158 | } | 159 | } |
@@ -193,8 +194,12 @@ namespace OpenSim.Framework | |||
193 | { | 194 | { |
194 | if (kvp.Value.Equals(value)) | 195 | if (kvp.Value.Equals(value)) |
195 | { | 196 | { |
196 | Dictionary2.Remove(key2); | 197 | try { } |
197 | Dictionary1.Remove(kvp.Key); | 198 | finally |
199 | { | ||
200 | Dictionary2.Remove(key2); | ||
201 | Dictionary1.Remove(kvp.Key); | ||
202 | } | ||
198 | found = true; | 203 | found = true; |
199 | break; | 204 | break; |
200 | } | 205 | } |
@@ -224,10 +229,9 @@ namespace OpenSim.Framework | |||
224 | { | 229 | { |
225 | rwLock.EnterWriteLock(); | 230 | rwLock.EnterWriteLock(); |
226 | gotLock = true; | 231 | gotLock = true; |
232 | Dictionary1.Clear(); | ||
233 | Dictionary2.Clear(); | ||
227 | } | 234 | } |
228 | |||
229 | Dictionary1.Clear(); | ||
230 | Dictionary2.Clear(); | ||
231 | } | 235 | } |
232 | finally | 236 | finally |
233 | { | 237 | { |
@@ -487,13 +491,13 @@ namespace OpenSim.Framework | |||
487 | { | 491 | { |
488 | rwLock.EnterWriteLock(); | 492 | rwLock.EnterWriteLock(); |
489 | gotWriteLock = true; | 493 | gotWriteLock = true; |
490 | } | ||
491 | 494 | ||
492 | for (int i = 0; i < list.Count; i++) | 495 | for (int i = 0; i < list.Count; i++) |
493 | Dictionary1.Remove(list[i]); | 496 | Dictionary1.Remove(list[i]); |
494 | 497 | ||
495 | for (int i = 0; i < list2.Count; i++) | 498 | for (int i = 0; i < list2.Count; i++) |
496 | Dictionary2.Remove(list2[i]); | 499 | Dictionary2.Remove(list2[i]); |
500 | } | ||
497 | } | 501 | } |
498 | finally | 502 | finally |
499 | { | 503 | { |