lunedì 15 agosto 2011 03:09
What do you think about offering the option to temporarily suspend blocks - maybe by passing something like a SuspensionToken into ExecutionDataflowBlockOptions. This is to allow Dataflow networks to work in the background - so you pause them when the UI is busy or you've got a foreground task running.
Because Dataflow is so good at getting the CPU hot, the ability to pause the network is perhaps more important than a background process that uses only one core.
A workaround would be to have code within the processing delegate await a custom suspension token and return a Task to the block. But then Dataflow would assume those blocks aren't making progress and may take action such as increasing concurrency, right?
A SuspensionToken may also open up unit testing possibilities, although this would require a more elaborate interface (e.g., the ability to let the block process a single message and continue).
Write LINQ queries interactively - www.linqpad.net
Tutte le risposte
lunedì 22 agosto 2011 15:02Proprietario
Thanks for the suggestion. It's something we've considered in the past and may revisit. In the meantime, you could approximate this by setting the BoundedCapacity for the target block to 1, and the unlinking / relinking it from its source in order to suspend / resume.