Re: Setting up an auxiliary task for use with Distributed Objects
Re: Setting up an auxiliary task for use with Distributed Objects
- Subject: Re: Setting up an auxiliary task for use with Distributed Objects
- From: Michael Ash <email@hidden>
- Date: Fri, 17 Apr 2009 07:07:21 -0400
On Fri, Apr 17, 2009 at 3:10 AM, Ken Thomases <email@hidden> wrote:
> On Apr 16, 2009, at 11:12 PM, Oleg Krupnov wrote:
>
>> @Ken
>>>
>>> with something like:
>>>
>>> while ([vendedObj shouldKeepRunning])
>>> [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
>>> beforeDate:[NSDate distantFuture]];
>>>
>>
>> I think I've seen this code somewhere in the docs, but I haven't and I
>> still don't understand how it can terminate the run loop, if the
>> beforeDate specifies distant future? The shouldKeepRunning flag seems
>> to be checked once at the beginning and never again. Could you explain
>> how it's supposed to work?
>
> The -[NSRunLoop runMode:beforeDate:] method returns after processing a
> single firing of an input source. So, it _can_ block until the date
> provided if nothing is happening, but if a message comes in via D.O. it will
> be processed and then control will return to the while loop.
A much simpler technique would be to simply have the DO
quit-this-process method call exit(), which will terminate the program
directly without having to fall back through the runloop.
Mike
_______________________________________________
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