Re: CFRunLoop
Re: CFRunLoop
- Subject: Re: CFRunLoop
- From: Andreas Monitzer <email@hidden>
- Date: Wed, 5 Sep 2001 16:59:57 +0200
On Wednesday, September 5, 2001, at 04:16 , Robert S Goldsmith wrote:
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)
,
That's not correct, it's NSRunLoop.
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.
I've made the experience that adding things to the current CFRunLoop
integrates pretty well into using NSRunLoop (NSApplication uses NSRunLoop)
. That means that those C-callbacks still work fine.
I personally wrote a callback that translates the event into an
NSNotification and posts it, it's easier to handle it in ObjC-classes that
way.
However, when you don't need CoreFoundation for capturing that event (may
not be possible with IOKit), try to avoid it.
andy
--
"He was addicted to life. But we cured him"
References: | |
| >Re: CFRunLoop (From: Robert S Goldsmith <email@hidden>) |