Re: NSRunLoop vs. CFRunLoop
Re: NSRunLoop vs. CFRunLoop
- Subject: Re: NSRunLoop vs. CFRunLoop
- From: Dustin Voss <email@hidden>
- Date: Sat, 21 Jun 2003 00:43:40 -0700
On Friday, June 20, 2003, at 12:01 PM, Ron Wagner wrote:
I have two apps which I want to communicate with each other via
distributed objects. One of them is a straight cocoa app, the other is
implemented as a core foundation tool. I picked core foundation because
I am using IOKit to talk to a USB device and IOKit matches up well with
core foundation, as far as notifications and CFRunLoops goes.
In adding distributed objects to the tool, I am reading in the
Anguish/Buck/Yacktman book about DO, which gives a great little example
using NSRunLoop. I tried converting the core foundation tool to a
foundation tool using NSRunLoop and all works well except exiting the
runLoop. There seems to be no documented way to stop an NSRunLoop short
of removing all input sources. My old CFRunLoopStop() does not work
with an NSRunLoop. Is there any equivalent to CFRunLoopStop() for
NSRunLoops?
Yeah. CFRunLoopStop hasn't worked with NSRunLoops in my experience. And
you will never be able to remove all the input sources.
Best solution is to run the run-loop for only a second at a time or so,
and check a flag to see if you should run another second.
Next question is the part about [[NSRunLoop currentRunLoop]
configureAsServer]. From Apple's documentation, all that is said is:
- (void)configureAsServer
Performs all necessary configuration to make the receiver suitable for
use by a server process.
The Anguish/Buck/Yacktman book says that it tells the current run loop
not to terminate just because no input is pending. According to the
Apple docs, a run loop will not terminate until all input sources have
been removed. Does anyone know what configureAsServer really does, and
is it really needed for DO? I tried commenting it out and it ran fine,
so I'm wondering what I'll be missing if I leave it out, and what side
affects it will cause if I leave it in.
I think it just sets up a DO listener input source, but I don't know
for sure.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.