Created
November 28, 2011 21:55
-
-
Save MrRooni/1402267 to your computer and use it in GitHub Desktop.
async'ing a dispatch_release
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
dispatch_queue_t some_worker_queue = dispatch_queue_create("some_worker_queue", DISPATCH_QUEUE_SERIAL); | |
dispatch_async(some_worker_queue, ^{ | |
// Perform some work | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
dispatch_release(some_worker_queue); | |
}); | |
}); |
I would prefer this:
dispatch_queue_t queue = dispatch_queue_create("work", 0);
dispatch_async(queue ^{
// work work work
});
dispatch_release(queue);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not move the dispatch_release() call to the same scope as the dispatch_queue_create() call? It should be retained while it’s performing work.