Re: NSTask in NSOperation
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