Guest User

Untitled

a guest
Oct 17th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. let queue1 = DispatchQueue(label: "com.reejo.test",
  2. qos: .userInitiated,
  3. attributes: .concurrent,
  4. autoreleaseFrequency: .inherit,
  5. target: DispatchQueue.global())
  6.  
  7. queue1.async {
  8. print("welcome!")
  9. }
  10.  
  11. let operationQueue = OperationQueue()
  12.  
  13. let blockOperation = BlockOperation {
  14. print("Welcome on BlockOperation")
  15. }
  16. blockOperation.queuePriority = .low
  17. blockOperation.qualityOfService = .background
  18.  
  19.  
  20. let dependentOperation = BlockOperation {
  21. print("Pre block operation")
  22. }
  23. dependentOperation.queuePriority = .veryLow
  24. dependentOperation.qualityOfService = .background
  25.  
  26. let plainOperation = Operation()
  27. plainOperation.completionBlock = {
  28. print("plain operation depending on none")
  29. }
  30. plainOperation.queuePriority = .veryHigh
  31.  
  32. blockOperation.addDependency(dependentOperation)
  33. operationQueue.addOperation(blockOperation)
  34. operationQueue.addOperation(dependentOperation)
  35. operationQueue.addOperation(plainOperation)
  36.  
  37. // welcome!
  38. // Pre block operation
  39. // plain operation depending on none
  40. // Welcome on BlockOperation
Add Comment
Please, Sign In to add comment