custom runloop notification- which approach to take?
custom runloop notification- which approach to take?
- Subject: custom runloop notification- which approach to take?
- From: Philip Lukidis <email@hidden>
- Date: Fri, 18 Nov 2005 10:33:13 -0500
Hopefully this is not OT. If so, my apologies.
I have to implement a shared library (within a framework). The bottom edge
of the shared library will communicate with a daemon via local sockets
(thanks to the list for helping me find a sample of this). However, I will
be required to notify the client of the shared library of interesting events
(changes in hardware, departure of hardware, etc). Within Windows, I might
have used custom messages to be send to a window procedure. However, I'm
not sure at all what would be the best way to proceed here with OSX.
The simplest thing would be for the client of the shared library to send a
callback function, which I could invoke. But that's a bit bare bones, and
so I'm also looking into adding a custom source to a runloop, which would
result in a callback function being invoked. I'm just not sure which way
would be best for my needs. It seems that CFMessagePort would serve, but
there is also CFMachPort, and I don't know which is preferable. Concerning
CFMachPort, there is no CF interface for sending data to a port- the
CFMachPort doc says "To send data, you must use the Mach APIs with the
native Mach port, which is not described here." So where can I find this
documentation? I might cringe a bit if I should be forced to use native
mach APIs, because I'm not sure they would remain unchanged across OS
upgrades (perhaps this is an unreasonable fear, but I'm fairly new to OSX).
Any thoughts? Are mach ports the way to go for this functionality, and, if
so, where might I find some mach API documentation for sending to a port?
If mach ports are not the way to go, what would be? (CFMessagePort for
example). I would like to stick to CF types, as I don't know right now what
type of application will be using the shared library (I understand that CF
types can be used by Carbon and Cocoa).
thanks for any insight,
Philip Lukidis
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden