Hosam Aly
Hosam Aly

Reputation: 42443

Downgrading ReaderWriterLockSlim UpgradeableReadLock to simple ReadLock

The documentation of ReaderWriterLockSlim.EnterUpgradeableReadLock says:

A thread in upgradeable mode can downgrade to read mode or upgrade to write mode.

How do I downgrade the lock to a read lock? The documentation does't tell...

[Edit:] I'm not trying to get the write lock. I just want to downgrade the upgradeable lock to a read lock so that another thread can acquire the upgradeable lock.

Upvotes: 3

Views: 1675

Answers (1)

Eric Rosenberger
Eric Rosenberger

Reputation: 9117

According to the MSDN documentation for ReaderWriterLockSlim (the class itself):

"A thread in upgradeable mode can downgrade to read mode by first calling the EnterReadLock method and then calling the ExitUpgradeableReadLock method."

Upvotes: 6

Related Questions