Re: CFRunLoop
Re: CFRunLoop
- Subject: Re: CFRunLoop
- From: Chris Kane <email@hidden>
- Date: Wed, 5 Sep 2001 13:27:05 -0700
Underneath NSApplication -run is NSRunLoop, and underneath that is
CFRunLoop. It isn't that there are equivalents -- they are each built
on top of the next lower layer. You don't need to change how you are
registering/unregistering input sources. Just stop running the run loop
by hand. NSApplication will do that for you.
If you're getting a CFRunLoopSourceRef or whatever from IOKit, for
example, by all means continue to use CFRunLoop API to add that to the
thread's current run loop.
In doing user input handling, NSApplication will run the run loop for
you, which will watch for user input events as well as watching the
things you've put in the run loop.
Chris Kane
Cocoa Frameworks, Apple
On Wednesday, September 5, 2001, at 07:16 AM, Robert S Goldsmith wrote:
Hi :)
Well, I have been learning USB and have created an ObjC class to handle
communication with my Rio500 using IOKit and CoreFoundation. In order
to be notified when the Rio is plugged in and unplugged, i am currently
using CFRunLoop calls to add a source, wait for an event (such as
plugging in or unplugging) and then (currently) just printing out the
status (plugged / unplugged).
My aim is to integrate this all in a giu to allow people to do cool
stuff with the Rio500 - like upload startup splash animations. The
CFRunLoop stuff is useful for not only the plugged / unplugged
callbacks but also for asyncronous uploading and downloading on the usb
pipes. Therefore, i can't just do away with them.
Knowing AppKit has it's own equivalent to CFRunLoopRun
(NSApplicationRun), I guessed I should use that instead. However, how
do I ask NSApplicationRun to notify me (somehow) when the Rio is
plugged and unplugged and when asyncronous operations have finished,
like CFRunLoop could do.
Robert
Ondra Cada wrote:
Robert,
Robert Goldsmith (RG) wrote at Wed, 5 Sep 2001 10:48:39 +0100:
RG> Ok, so the Cocoa NSApplication callback structure will directly
There are no callbacks in ObjC (but it the most generic sense of the
term). Sending messages beween objects is what you use.
RG> accept CFRunLoop sources/timers? Or do i need to use a different
set
RG> of calls to add and remove the sources?
Hm. What's your goal, actually? For timed events you should use
NSTimer (or performSelectr:withObject:afterDelay: in the simplest
cases which are not worth it). What other sources you mean?
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
References: | |
| >Re: CFRunLoop (From: Robert S Goldsmith <email@hidden>) |