문제

Is there an incrementing AutoResetEvent, or something similar in c# libraries?

How would one go about rolling an efficient implementation of one, or alternatively, address the problem stated without doing so?

Problem: To clarify my need, I have a producer / consumer situation, where I have an unknown number of producers, and a fixed number of consumers.

Edit:Forgot to mention one issue, I cannot use .NET 4.0 so I cannot use ConcurrentQueue<T> :'( , I need to stick with .NET 2.0 for now.

도움이 되었습니까?

해결책

Check out if Semaphore would work for your scenario.

다른 팁

Have you seen .NET 4's ConcurrentQueue<T>? It takes care of all of that for you.

Since you can't use .NET 4, you can use AutoResetEvent in the System.Threading namespace.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top