Re: NSOperation Issues
Re: NSOperation Issues
- Subject: Re: NSOperation Issues
- From: Ken Thomases <email@hidden>
- Date: Thu, 03 Apr 2014 19:16:33 -0500
On Apr 3, 2014, at 7:02 PM, Varun Chandramohan wrote:
> On 4/04/2014 10:47 am, "Jerry Krinock" <email@hidden> wrote:
>
>> On 2014 Apr 03, at 16:11, Varun Chandramohan
>> <email@hidden> wrote:
>>
>>> when I port the same code to be used as a user daemon, I noticed that
>>> NSOperationQueue fails.
>>
>> I¹d suspect a run loop issue. For example, maybe your daemon is exitting
>> before the operation begins.
>
> Oh you mean, the runloop has not been initialised and the daemon is
> exiting before that?
> That could be the cause. Thanks I will investigate.
If the code that was shown was running on the main thread, then the process should not have exited. The code called [queue waitUntilAllOperationsAreFinished].
In general, operation queues don't rely on the run loop.
It is correct that if the code shown was in a background thread and nothing was keeping the main thread from exiting, then the process will be terminated, likely before the operation finished (or maybe even started) executing. Parking the main thread in a loop running its run loop, assuming the run loop has at least one input source, is one way of preventing the main thread from exiting. But that's the only tenuous relationship between run loops and operation queues.
Regards,
Ken
_______________________________________________
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