A named Reader Writer lock in C#
C#
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
NamedReaderWriterLock
NamedReaderWriterLock.sln
README.markdown

README.markdown

Usage:

private static NamedReaderWriterLock<string> locker = new NamedReaderWriterLock<string>();
public void DoSomethingConcurrent(string lockName)
{
    using (locker.LockRead(url))
    {
       //Do something concurrent that only requires
       //read access to the resource
    }
    using (locker.LockUpgradeableRead(url))
    {
       //Do something concurrent that only requires
       //read access to the resource, but that may require
       //upgrading to a Write lock later in the code
    }
    using (locker.LockWrite(url))
    {
       //Do something concurrent that requires
       //write access to the resource
    }
}

See the home page for more information.