Creating a blocking Queue in .NET?

后端 未结 10 1028
半阙折子戏
半阙折子戏 2020-11-22 01:14

I have a scenario where I have multiple threads adding to a queue and multiple threads reading from the same queue. If the queue reaches a specific size all threads<

10条回答
  •  野的像风
    2020-11-22 01:41

    Starting with .NET 5.0/Core 3.0 you can use System.Threading.Channels
    Benchmarks from this (Asynchronous Producer Consumer Pattern in .NET (C#)) article show a significant speed boost over BlockingCollection!

提交回复
热议问题