Skip to content

resolve inserting operations as a batch race to the execution of operations #621

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
Sep 6, 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
6 changes: 4 additions & 2 deletions Foundation/NSOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,13 @@ open class OperationQueue: NSObject {
execution. The only differential is that the block enqueued to dispatch_async
is balanced with the number of Operations enqueued to the NSOperationQueue.
*/
lock.lock()
ops.forEach { (operation: Operation) -> Void in
lock.lock()
operation._queue = self
_operations.insert(operation)
lock.unlock()
}
lock.unlock()
ops.forEach { (operation: Operation) -> Void in
#if DEPLOYMENT_ENABLE_LIBDISPATCH
if let group = waitGroup {
group.enter()
Expand Down