Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dispatch_queue_t main = dispatch_get_main_queue();
- dispatch_sync(main, ^
- {
- [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationAuthenticationSuccess object:nil userInfo:ret];
- });
- dispatch_queue_t main = dispatch_get_main_queue();
- dispatch_block_t block = ^
- {
- [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationAuthenticationSuccess object:nil userInfo:ret];
- };
- if (dispatch_get_current_queue() == main)
- block(); // execute the block directly, as main is already the current active queue
- else
- dispatch_sync(main, block); // ask the main queue, which is not the current queue, to execute the block, and wait for it to be executed before continuing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement