diff options
author | Diva Canto | 2009-10-07 19:45:57 -0700 |
---|---|---|
committer | Diva Canto | 2009-10-07 19:45:57 -0700 |
commit | dd80380df5e47c0d67466f7d509898a71e19abd0 (patch) | |
tree | 176cd415d3b96e5145b8bcc420aa7048b7ae9b00 | |
parent | Bug fix. (diff) | |
download | opensim-SC_OLD-dd80380df5e47c0d67466f7d509898a71e19abd0.zip opensim-SC_OLD-dd80380df5e47c0d67466f7d509898a71e19abd0.tar.gz opensim-SC_OLD-dd80380df5e47c0d67466f7d509898a71e19abd0.tar.bz2 opensim-SC_OLD-dd80380df5e47c0d67466f7d509898a71e19abd0.tar.xz |
Another go at the deadlock: not locking TryGetValue, and just catch/ignore exceptions.
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs index 9be9480..36e1f49 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs | |||
@@ -215,33 +215,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
215 | 215 | ||
216 | public bool TryGetValue(UUID key, out LLUDPClient value) | 216 | public bool TryGetValue(UUID key, out LLUDPClient value) |
217 | { | 217 | { |
218 | //bool success; | 218 | ////bool success; |
219 | //bool doLock = !rwLock.IsUpgradeableReadLockHeld; | 219 | ////bool doLock = !rwLock.IsUpgradeableReadLockHeld; |
220 | //if (doLock) rwLock.EnterReadLock(); | 220 | ////if (doLock) rwLock.EnterReadLock(); |
221 | 221 | ||
222 | //try { success = Dictionary1.TryGetValue(key, out value); } | 222 | ////try { success = Dictionary1.TryGetValue(key, out value); } |
223 | //finally { if (doLock) rwLock.ExitReadLock(); } | 223 | ////finally { if (doLock) rwLock.ExitReadLock(); } |
224 | 224 | ||
225 | //return success; | 225 | ////return success; |
226 | 226 | ||
227 | lock (m_sync) | 227 | //lock (m_sync) |
228 | return Dictionary1.TryGetValue(key, out value); | 228 | // return Dictionary1.TryGetValue(key, out value); |
229 | 229 | ||
230 | try | ||
231 | { | ||
232 | return Dictionary1.TryGetValue(key, out value); | ||
233 | } | ||
234 | catch { } | ||
235 | value = null; | ||
236 | return false; | ||
230 | } | 237 | } |
231 | 238 | ||
232 | public bool TryGetValue(IPEndPoint key, out LLUDPClient value) | 239 | public bool TryGetValue(IPEndPoint key, out LLUDPClient value) |
233 | { | 240 | { |
234 | //bool success; | 241 | ////bool success; |
235 | //bool doLock = !rwLock.IsUpgradeableReadLockHeld; | 242 | ////bool doLock = !rwLock.IsUpgradeableReadLockHeld; |
236 | //if (doLock) rwLock.EnterReadLock(); | 243 | ////if (doLock) rwLock.EnterReadLock(); |
237 | 244 | ||
238 | //try { success = Dictionary2.TryGetValue(key, out value); } | 245 | ////try { success = Dictionary2.TryGetValue(key, out value); } |
239 | //finally { if (doLock) rwLock.ExitReadLock(); } | 246 | ////finally { if (doLock) rwLock.ExitReadLock(); } |
240 | 247 | ||
241 | //return success; | 248 | ////return success; |
242 | 249 | ||
243 | lock (m_sync) | 250 | //lock (m_sync) |
251 | // return Dictionary2.TryGetValue(key, out value); | ||
252 | |||
253 | try | ||
254 | { | ||
244 | return Dictionary2.TryGetValue(key, out value); | 255 | return Dictionary2.TryGetValue(key, out value); |
256 | } | ||
257 | catch { } | ||
258 | value = null; | ||
259 | return false; | ||
260 | |||
245 | } | 261 | } |
246 | 262 | ||
247 | public void ForEach(Action<LLUDPClient> action) | 263 | public void ForEach(Action<LLUDPClient> action) |