In a "producer consumer" scenario please forget ConcurrentQueue... please use BlockingCollection. Your CPU will thank you ;-)
https://learn.microsoft.com/en-us/dotnet/standard/collections/thread-safe/blockingcollection-overview

#csharp #dotnet #dotnetcore

BlockingCollection Overview - .NET

Read about BlockingCollection, a thread-safe collection class in .NET. This class offers features like concurrent adding & taking of items from many threads.

I wasnt aware of Channels, my bad.. haha and my client has its own complex implementation. So it will take a while to convert
@DotNetGuy this is interesting! Thanks
@DotNetGuy trying to relate in my mind to Channels and figure out if this is complementary or a replacement.

@DotNetGuy these older things don’t seem to be compatible with the task / async await world, and are not yet updated. I think we are supposed to use channels.

https://learn.microsoft.com/en-us/dotnet/core/extensions/channels

Channels - .NET

Learn the official synchronization data structures in System.Threading.Channels for producers and consumers with .NET.