Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. dispatch_queue_t main = dispatch_get_main_queue();
  2. dispatch_sync(main, ^
  3. {
  4. [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationAuthenticationSuccess object:nil userInfo:ret];
  5. });
  6.  
  7. dispatch_queue_t main = dispatch_get_main_queue();
  8. dispatch_block_t block = ^
  9. {
  10. [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationAuthenticationSuccess object:nil userInfo:ret];
  11. };
  12. if (dispatch_get_current_queue() == main)
  13. block(); // execute the block directly, as main is already the current active queue
  14. else
  15. 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