C
C#15mo ago
а

❔ What is the best approach for a process ConcurrentQueue?

I have a ConcurrentQueue which is filled by different threads. There is also a class that should, while there are elements in the queue, get the front one and process it. What is the best way to implement this? I only have this idea: In a loop with a timer, check if there are elements in the queue and if so, start processing the queue. Is there a better approach?
4 Replies
canton7
canton715mo ago
Why not use a BlockingCollection (which uses a ConcurrentQueue internally)
а
а15mo ago
Thank you very much! It's just what I need.
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts