Skip to content

Fix build warnings in NSOperation #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Foundation/NSOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ open class Operation: NSObject {
// The completion block property is a bit cagey and can not be executed locally on the queue due to thread exhaust potentials.
// This sets up for some strange behavior of finishing operations since the handler will be executed on a different queue
if let completion = completionBlock {
DispatchQueue.global(attributes: .qosBackground).async { () -> Void in
DispatchQueue.global(qos: .background).async { () -> Void in
completion()
}
}
Expand Down Expand Up @@ -326,9 +326,9 @@ open class OperationQueue: NSObject {
} else {
effectiveName = "NSOperationQueue::\(Unmanaged.passUnretained(self).toOpaque())"
}
let attr: DispatchQueueAttributes
let attr: DispatchQueue.Attributes
if maxConcurrentOperationCount == 1 {
attr = .serial
attr = []
} else {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DispatchQueue.Attributes defines only .concurrent

attr = .concurrent
if maxConcurrentOperationCount != NSOperationQueueDefaultMaxConcurrentOperationCount {
Expand Down Expand Up @@ -408,7 +408,7 @@ open class OperationQueue: NSObject {
group.enter()
}

let block = DispatchWorkItem(group: queueGroup, flags: .enforceQoS) { () -> Void in
let block = DispatchWorkItem(flags: .enforceQoS) { () -> Void in
if let sema = self._concurrencyGate {
Copy link
Member Author

@pushkarnk pushkarnk Aug 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new DispatchWorkItem(qos:flags:block:) does not take the queue group

sema.wait()
self._runOperation()
Expand All @@ -420,7 +420,7 @@ open class OperationQueue: NSObject {
group.leave()
}
}
_underlyingQueue.async(execute: block)
_underlyingQueue.async(group: queueGroup, execute: block)
#endif
}
#if DEPLOYMENT_ENABLE_LIBDISPATCH
Expand Down