How to break down long running tasks into chunks? | developer.brewmp.com How to break down long running tasks into chunks? | developer.brewmp.com

Developer

How to break down long running tasks into chunks?

Forums:

If I have a long running activity how do I break it into chunks so that the device remains responsive?

 

Lets suppose for example I have a spreadsheet application following the MVC pattern and the user pastes a formula into some cells. The Model component might therefore receive a function call such as RecalculateCells(a range of cells).

 

If the number of cells is very large lets assume it might take several seconds to calculate.

If RecalculateCells() is implemented as a single synchronous unit it'll obviously make the app UI unresponsive until its finished.

What is the best way of breaking down RecalculateCells() into a number of chunks? Specifically after one chunk of activity has been procesed what is the mechanism for yielding to the OS in case there is something else to deal with and what is the mechanism whereby my recalculate cell chunk gets notified when to resume with the next chunk of processing?

 

Thanks

Learn how to use the IDispatcher. With that, you can queue a "next step" callback operation and there is also a method that allows you to wait for a specified number of milliseconds before execution of the callback.

Learn how to use the IDispatcher. With that, you can queue a "next step" callback operation and there is also a method that allows you to wait for a specified number of milliseconds before execution of the callback.

Hello,
Please refer to the 'Programing practices technology guide' (https://developer.brewmp.com/resources/tech-guides/brew-mp-best-practice...) 
 Specifically :https://developer.brewmp.com/resources/tech-guides/brew-mp-best-practice...
 has some suggestions for you.
 
HTH

Hello,
Please refer to the 'Programing practices technology guide' (https://developer.brewmp.com/resources/tech-guides/brew-mp-best-practice...) 
 Specifically :https://developer.brewmp.com/resources/tech-guides/brew-mp-best-practice...
 has some suggestions for you.
 
HTH

Or you can use IThread. 

Or you can use IThread.