SingleProducerConstrained and MaxDegreeOfParallelism

前端 未结 1 2026
执念已碎
执念已碎 2021-02-08 02:36

In the C# TPL Dataflow library, SingleProducerConstrained is an optimisation option for ActionBlocks you can use when only a single thread is feeding the action block:

相关标签:
1条回答
  • 2021-02-08 03:23

    Yes, I think it's considered a single producer.

    This is because all the built-int blocks maintain ordering, so item 2 can be offered (using the OfferMessage() method) to the target block only after item 1 has been accepted. And this constraint means that there can be only one thread offering messages to the target at a time, which follows the definition of "single producer".

    0 讨论(0)
提交回复
热议问题