문제

When I create a Dataflow Block I specify its MaxDegreeOfParallelism like this:

...New ExecutionDataflowBlockOptions With 
   {.MaxDegreeOfParallelism = System.Environment.ProcessorCount - 1}...

Is any way to change it later?

도움이 되었습니까?

해결책

No, you can't do that.

What you can do is to create the block with a high enough MDOP (possibly Unbounded) and use SemaphoreSlim to limit the degree of parallelism to what you actually want.

Then, when you want to change the degree of parallelism, call Release(int releaseCount) (to increase it) or await WaitAsync() in a loop (to decrease it).

다른 팁

No. You can't change the degree while using the same block.

But, you can set it to a higher number from the start and it will only use as much as it needs (hence Max).

Or you could create a new block with a higher MaxDegreeOfParallelism and start posting your items to it while waiting for the old block to finish.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top