classic producer consumer pattern using blockingcollection and tasks .net 4 TPL

前端 未结 3 1840
醉酒成梦
醉酒成梦 2020-12-05 07:49

Please see below pseudo code

//Single or multiple Producers produce using below method
    void Produce(object itemToQueue)
    {
        concurrentQueue.enq         


        
3条回答
  •  遥遥无期
    2020-12-05 08:30

    You would use BlockingCollection. There's an example in the documentation.

    That class is specifically designed to make this trivial.

提交回复
热议问题