1 | #import <dispatch/dispatch.h> |
---|---|
2 | #include <stdio.h> |
3 | |
4 | void one() { |
5 | printf(format: "one...\n"); // breakpoint 1 |
6 | } |
7 | |
8 | void two() { |
9 | printf(format: "two...\n"); |
10 | one(); |
11 | } |
12 | |
13 | void three() { |
14 | printf(format: "three...\n"); |
15 | two(); |
16 | } |
17 | |
18 | int main(int argc, char *argv[]) { |
19 | printf(format: "main...\n"); |
20 | // Nest from main queue > global queue > main queue. |
21 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), |
22 | ^{ |
23 | dispatch_async(dispatch_get_main_queue(), ^{ |
24 | three(); |
25 | }); |
26 | }); |
27 | dispatch_main(); |
28 | } |
29 |