4 ms·
If the code block can run in a different thread (like in Grand Central Dispatch) it is very useful to do stuff in the background without blocking the GUI (that
by wslh 15y ago
If the code block can run in a different thread (like in Grand Central Dispatch) it is very useful to do stuff in the background without blocking the GUI (that executes in a specific thread) and using the current scope variables. A progress bar is a clear example of this.
Doing this without code blocks adds extra code like launching another thread, connecting the scope to the new thread.
- lee 15y agoSorry, I'm not following. Why couldn't you use a function here instead of a code block to do the exact same thing?