Last active
August 29, 2015 13:57
-
-
Save albertodebortoli/9445448 to your computer and use it in GitHub Desktop.
Objective-C Concurrency/Threading/GCD Trivia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @synchronized(self) { | |
| NSLog(@"%i", 1); | |
| dispatch_queue_t queue = dispatch_queue_create("com.albertodebortoli.serial_queue", DISPATCH_QUEUE_SERIAL); | |
| dispatch_sync(queue, ^{ | |
| NSLog(@"%i", 2); | |
| @synchronized(self) { | |
| NSLog(@"%i", 3); | |
| } | |
| NSLog(@"%i", 4); | |
| }); | |
| NSLog(@"%i", 5); | |
| } | |
| // what's the order of the logs and why, does the program execute until the end? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment