• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOperation and waitUntilFinished
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOperation and waitUntilFinished


  • Subject: Re: NSOperation and waitUntilFinished
  • From: Jonathan Hull <email@hidden>
  • Date: Sat, 20 Oct 2012 11:55:27 -0700

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).

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.

Thanks,
Jon

On Oct 20, 2012, at 10:15 AM, Koen van der Drift <email@hidden> wrote:

>
> On Oct 20, 2012, at 12:53 PM, Gary L. Wade <email@hidden> wrote:
>
>> At the time when you call waitUntilAllOperationsAreFinished, no operations have been added, so there's nothing to wait on. Add the operation to the queue first and then call wait.
>> --
>
> I tried that too, but then it just stays in the operation and never finishes:
>
> start import
> begin of importRecords in operation
>
> and nothing else, it just sits there.
>
> - Koen.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
>


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSOperation and waitUntilFinished
      • From: Koen van der Drift <email@hidden>
References: 
 >NSOperation and waitUntilFinished (From: Koen van der Drift <email@hidden>)
 >Re: NSOperation and waitUntilFinished (From: "Gary L. Wade" <email@hidden>)
 >Re: NSOperation and waitUntilFinished (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: NSOperation and waitUntilFinished
  • Next by Date: Re: Scene Kit
  • Previous by thread: Re: NSOperation and waitUntilFinished
  • Next by thread: Re: NSOperation and waitUntilFinished
  • Index(es):
    • Date
    • Thread