Question

J'utilise un ReaderWriterLockSlim pour protéger l'accès au cache sur mon application ASP.NET. MSDN a des exemples d'utilisation de la serrure. Cependant cet article http://www.nobletech.co.uk/Articles/ReaderWriterLockMgr.aspx m'a inquiet au sujet des blocages. Est-ce vraiment un risque? Devrait mentionner la documentation MSDN cela?

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();
    }
}
Était-ce utile?

La solution

Désolé, je manque lu plus tôt,

Est-ce que cet attribut ne précise pas que?

[HostProtectionAttribute(SecurityAction.LinkDemand, MayLeakOnAbort = true)]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top