提交 36e827b0 编写于 作者: J Jérémie Laval

Also set readerDoneEvent when exiting an upgradeable lock and reader condition is correct.

It could cause a deadlock when a writer tested the rwlock value before RwRead was removed and another Upgradeable operation happened at the same time.
上级 e137468d
......@@ -292,7 +292,8 @@ namespace System.Threading {
ctstate.LockState ^= LockState.Upgradable;
ctstate.UpgradeableRecursiveCount--;
Interlocked.Add (ref rwlock, -RwRead);
if (Interlocked.Add (ref rwlock, -RwRead) >> RwReadBit == 0)
readerDoneEvent.Set ();
}
public void Dispose ()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册