我正在使用ReaderWriterLockSlim来保护对ASP.NET应用程序缓存的访问。 MSDN有使用锁的示例。但是这篇文章http://www.nobletech.co.uk/Articles/ReaderWriterLockMgr.aspx让我担心死锁。这真的有风险吗? MSDN文档是否应该提到这一点?
public string Read(int key)
{
cacheLock.EnterReadLock();
// What if thread abort happens here before getting into the try block?!
try
{
return innerCache[key];
}
finally
{
cacheLock.ExitReadLock();
}
}
答案 0 :(得分:2)
对不起,我想念早些时候,
此属性是否未指定?
[HostProtectionAttribute(SecurityAction.LinkDemand, MayLeakOnAbort = true)]