Another go at the deadlock: not locking TryGetValue, and just catch/ignore exceptions.
parent
29f03d95f3
commit
dd80380df5
|
@ -215,33 +215,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
public bool TryGetValue(UUID key, out LLUDPClient value)
|
public bool TryGetValue(UUID key, out LLUDPClient value)
|
||||||
{
|
{
|
||||||
//bool success;
|
////bool success;
|
||||||
//bool doLock = !rwLock.IsUpgradeableReadLockHeld;
|
////bool doLock = !rwLock.IsUpgradeableReadLockHeld;
|
||||||
//if (doLock) rwLock.EnterReadLock();
|
////if (doLock) rwLock.EnterReadLock();
|
||||||
|
|
||||||
//try { success = Dictionary1.TryGetValue(key, out value); }
|
////try { success = Dictionary1.TryGetValue(key, out value); }
|
||||||
//finally { if (doLock) rwLock.ExitReadLock(); }
|
////finally { if (doLock) rwLock.ExitReadLock(); }
|
||||||
|
|
||||||
//return success;
|
////return success;
|
||||||
|
|
||||||
lock (m_sync)
|
//lock (m_sync)
|
||||||
return Dictionary1.TryGetValue(key, out value);
|
// return Dictionary1.TryGetValue(key, out value);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Dictionary1.TryGetValue(key, out value);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
value = null;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetValue(IPEndPoint key, out LLUDPClient value)
|
public bool TryGetValue(IPEndPoint key, out LLUDPClient value)
|
||||||
{
|
{
|
||||||
//bool success;
|
////bool success;
|
||||||
//bool doLock = !rwLock.IsUpgradeableReadLockHeld;
|
////bool doLock = !rwLock.IsUpgradeableReadLockHeld;
|
||||||
//if (doLock) rwLock.EnterReadLock();
|
////if (doLock) rwLock.EnterReadLock();
|
||||||
|
|
||||||
//try { success = Dictionary2.TryGetValue(key, out value); }
|
////try { success = Dictionary2.TryGetValue(key, out value); }
|
||||||
//finally { if (doLock) rwLock.ExitReadLock(); }
|
////finally { if (doLock) rwLock.ExitReadLock(); }
|
||||||
|
|
||||||
//return success;
|
////return success;
|
||||||
|
|
||||||
lock (m_sync)
|
//lock (m_sync)
|
||||||
|
// return Dictionary2.TryGetValue(key, out value);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
return Dictionary2.TryGetValue(key, out value);
|
return Dictionary2.TryGetValue(key, out value);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
value = null;
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ForEach(Action<LLUDPClient> action)
|
public void ForEach(Action<LLUDPClient> action)
|
||||||
|
|
Loading…
Reference in New Issue