I have a producer / consumer problem. I currently have a simple Queue surrounded by lock .
I am trying to replace it with something more efficient.
My first choice was to use ConcurrentQueue , but I donβt see how to make my user wait for the next prepared message (without executing Thread.Sleep).
In addition, I would like to be able to clear the entire queue if its size reaches a certain number.
Can you suggest some existing class or implementation that would meet my requirements?
source share