阅读背景:

如何防止以下C#代码中的死锁?

来源:互联网 

The following C# class is used in a multithreaded enviroment. I removed very much of the actual code. The problem occurs when calling MethodA and MethodB almost simultaneously. The order of the lock in the IsDepleted property doesn't solves the problem. Removing lock(WaitingQueue) from the IsDepleted property solves the deadlock, but this solution causes a problem when another thread adds/removes an item from the WaitingQueue between the WaitingQueue.Count == 0 and Processing.Count == 0 statements.The following C# class is used in a multithread




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: