Guest User

Untitled

a guest
Oct 14th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. let queue = dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0)
  2. let group = dispatch_group_create()
  3.  
  4. dispatch_group_async(group, queue) {
  5. print("Job 1 done")
  6. }
  7.  
  8. dispatch_group_async(group, queue) {
  9. print("Job 2 done")
  10. }
  11.  
  12. // OR
  13. // let block1 = NSBlockOperation {
  14. // print("Job 1 done")
  15. // }
  16. //
  17. // let block2 = NSBlockOperation {
  18. // print("Job 2 done")
  19. // }
  20. //
  21. // for operation in [block1, block2] {
  22. // dispatch_group_async(group, queue, {
  23. // operation.start()
  24. // })
  25. // }
  26.  
  27. dispatch_group_notify(group, dispatch_get_main_queue()) {
  28. print("All done")
  29. }
Advertisement
Add Comment
Please, Sign In to add comment