On Sat, Oct 20, 2012 at 2:55 PM, Jonathan Hull <jh...@gbis.com> wrote: > You probably want to be using -addDependency: > > -waitUntilAllOperationsAreFinished just blocks the thread it is called on > until the receiver finishes (thus if you call it on the same thread as the > queue, it will block it forever).
Thanks, I think that is what called a deadlock? > > If you need to do something after the operation is done which is not an > operation itself, then you probably want to look at -setCompletionBlock:. > The block you provide will get called once the operation is complete (and let > you clean things up, etc…). Note that the block may not be called on the > main thread. Inside my NSOperation, I need to call executeFetchRequest on the main thread to query the main context to see if certain entities already exist (to avoid adding duplicates). I'll look into adding another operation to do some subsequent work and make that a dependency of the first operation. That way I can avoid using waitUntilFinished, and prevent the deadlock. - Koen. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com