RonLugge
RonLugge

Reputation: 5174

Does NSManagedObjectContext's performBlock method guarantee the order of operations?

The question pretty much covers it all. If I put in N blocks into the queue for the NSManagedObjectContext, will it perform them all in order, guaranteed, or is there a chance that some of them might get scrambled?

Upvotes: 3

Views: 301

Answers (1)

borrrden
borrrden

Reputation: 33421

I see no reason why NSManagedObjectContext wouldn't use GCD internally, and GCD queues are strictly FIFO. Of course I have no proof to confirm this, but it makes perfect sense to me since the goal of performBlock is thread safety, and performing only one operation at once in a given context, and why would Apple bother writing a system from the ground up when a perfectly functional one (GCD) already exists.

Upvotes: 3

Related Questions