As the title says, the question is, if a NSManagedObjectContext
with concurrency type NSPrivateQueueConcurrencyType
is serial or concurrent.
More specifically, if I call
[managedObjectContext performBlock:^{
}];
with a long running task, will other calls to that context with performBlock be blocked until the first one finished?
It is serial queue from Apple docs.
Or you can simply try to run this code and see the result. The numbers will be printed serially.
let privateMOC = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
privateMOC.perform {
for i in 0...8000 {
if i.isMultiple(of: 3000) {
print("1")
}
}
}
privateMOC.perform {
for i in 0...8000 {
if i.isMultiple(of: 3000) {
print("2")
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With