相关疑难解决方法(0)

TPL DataFlow,优先级链接块?

使用TPL.DataFlow块,是否可以将两个或多个源链接到单个ITargetBlock(例如ActionBlock)并确定源的优先级?

例如

BufferBlock<string> b1 = new ...
BufferBlock<string> b2 = new ...
ActionBlock<string> a = new ...

//somehow force messages in b1 to be processed before any message of b2, always
b1.LinkTo (a);
b2.LinkTo (a);
Run Code Online (Sandbox Code Playgroud)

只要b1中有消息,我希望这些消息被输入"a",一旦b1为空,b2消息就被推送到"a"

想法?

c# task-parallel-library tpl-dataflow

4
推荐指数
1
解决办法
1290
查看次数

标签 统计

c# ×1

task-parallel-library ×1

tpl-dataflow ×1