前言
本文内容主要来自 Pro Multithreading and Memory Management for iOS and OS X with ARC, Grand Central Dispatch, and Blocks 这本书,参考这篇文章。
Block 是语言级别的语法,是 C 语言的扩展。Block 可以解释为“包含了局部变量的匿名函数(anonymous functions together with automatic (local) variables)”。本文不多说 Block 的使用方法,着重讨论 Block 的实现机制。