• 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: NSTask in NSOperation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask in NSOperation


  • Subject: Re: NSTask in NSOperation
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 1 Oct 2010 11:33:04 -0700

On Thu, Sep 30, 2010 at 8:26 PM, Kunal Parmar <email@hidden> wrote:
> I am using a NSTask in NSOperation. But I am not getting any notifications.

NSTask relies on a runloop. Since you have no control over what thread
your operation runs in, you can't run a runloop on your operation's
thread, and therefore cannot use NSTask in this manner.

You will need to spawn your NSTasks on the main thread (or at least a
thread you own, not one owned by NSOperationQueue or GCD). When you
get your -taskDidTerminate: notification *on the main thread*, you can
enqueue another operation to handle the result of the task completing.

--Kyle Sluder
_______________________________________________

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

References: 
 >NSTask in NSOperation (From: Kunal Parmar <email@hidden>)

  • Prev by Date: Re: What does core data do during a Save As?
  • Next by Date: Re: Why is NSPopUp broken in drop-down mode?
  • Previous by thread: NSTask in NSOperation
  • Next by thread: NSMenuItem enabling
  • Index(es):
    • Date
    • Thread