Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let queue1 = DispatchQueue(label: "com.reejo.test",
- qos: .userInitiated,
- attributes: .concurrent,
- autoreleaseFrequency: .inherit,
- target: DispatchQueue.global())
- queue1.async {
- print("welcome!")
- }
- let operationQueue = OperationQueue()
- let blockOperation = BlockOperation {
- print("Welcome on BlockOperation")
- }
- blockOperation.queuePriority = .low
- blockOperation.qualityOfService = .background
- let dependentOperation = BlockOperation {
- print("Pre block operation")
- }
- dependentOperation.queuePriority = .veryLow
- dependentOperation.qualityOfService = .background
- let plainOperation = Operation()
- plainOperation.completionBlock = {
- print("plain operation depending on none")
- }
- plainOperation.queuePriority = .veryHigh
- blockOperation.addDependency(dependentOperation)
- operationQueue.addOperation(blockOperation)
- operationQueue.addOperation(dependentOperation)
- operationQueue.addOperation(plainOperation)
- // welcome!
- // Pre block operation
- // plain operation depending on none
- // Welcome on BlockOperation
Add Comment
Please, Sign In to add comment