On Fri, Apr 17, 2009 at 3:10 AM, Ken Thomases <[email protected]> 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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to