❔ How to pause BlockingCollection consumption?
I'm currently enumerating through a
BlockingCollection
(with an underlying ConcurrentQueue
backing class) using GetConsumingEnumerable()
. But I have to pause execution based on some logic, leaving items on the queue, until some other business logic resumes execution. Anyone know the best practice for that? Do I have to bypass GetConsumingEnumerable()
and instead write something like below, but adding pause logic?
2 Replies
Thank you @calledude I had seen a few references to
ManualResetEvent
in my searches but didn't quite understand it. I did end up implementing it, haven't tested yet, but very happy to come back and see you recommended the same!Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.