Adam Debono, University of Wollongong
Track: Tools & Tech; Audience: Intermediate
This talk is about how to use Grand Central Dispatch and Blocks. I feel that this is a very important subject as parallelism is becoming much more useful with multi-core processors now creeping into iOS devices as well as being in desktop computers. GCD and blocks simplifies the process of parallelising programs to maximise efficiency.
Talk Outline:
1. Why use GCD & Async?
- 1. unblock the main thread
- 2. run background processes
- 3. execute operations that don’t need to be run immediately
2. Intro to Blocks
- 1. What is a block
- 2. Where would you use blocks?
- 1. Completion/Error handlers
- 2. Concurrency (GCD)
- 3. Use functions like variables.
3. Examples
- 1. Create and use a block var
- 2. blocks in function parameters (C and Obj-c)
- 3. block types
- 4. Global blocks
4. Blocks and Variables
5. Dispatch Blocks
3. Intro to GCD
- 1. queues
- 1. declaring
- 2. get main/global queue
- 2. Queueing tasks (async, sync, after, apply, once)
- 1. dispatch_async/dispatch_sync
- 2. suspend/resume queue
- 3. recursive decomposition
- 3. Looping/Multiple runs
- 1. std. for loop with dispatch_async
- 2. dispatch_apply
- 3. fast enumeration/forin
4. Other
- 1. dispatch_after
- 2. dispatch_once -> singleton
5. lock functionality
6. groups
Plus lots of demos and examples.