site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Apr 25, 2006, at 1:21 PM, Kevin Brock wrote: davez _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... The comment in the header says that calling launch_msg() with no message is a way to receive asynchronous messages. Polling this seems clunky... Is there a way to register a callback for asynchronous messages? Yes, that's what launch_get_fd() is for. I'm not sure I see how this works. In the header, launch_get_fd takes no arguments, so I can't use it to register a callback. It looks as though, if I call it at the right time, it will return a file descriptor. It's not clear what context it should be called in, or what fiel descriptor it will return... It *does* look as though I have to poll it. The idea is that you add that FD to your event loop (select(),poll (),kqueue...) along with all your normal work. When that FD becomes readable, then call launch_msg(NULL) in a loop until it returns NULL and errno == 0. But this is really not very interesting to talk about, since nothing in launchd actually vends asynchronous messages right now, and honestly, given the way launchd is evolving, nothing may in the future either. It was something we added because we thought we might use it, but reality isn't panning out that way. Shrug. This email sent to site_archiver@lists.apple.com