public void DowngradeFromWriterLock(ref LockCookie lockCookie)
{
lock (this) {
if (!HasWriterLock())
throw new ApplicationException ("The thread does not have the writer lock.");
state = lockCookie.ReaderLocks;
reader_locks [Thread.CurrentThreadId] = state;
if (readers > 0) {
Monitor.PulseAll (this);
}
// MSDN: A thread does not block when downgrading from the writer lock,
// even if other threads are waiting for the writer lock
}
}