Re: Run loops: Mach messages vs. kqueues
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Jan 20, 2010, at 1:38 AM, Dave Keck wrote:
Hello,
Is there a reason that CFRunLoop is implemented atop Mach messages rather than a kqueue? If it were implemented atop a kqueue, not only would CFRunLoop maintain support for waking when a Mach message arrives, but it could also be awoken when data is available on an arbitrary file descriptor. (As far as I'm aware, the only way to do this currently is to spawn a secondary thread to monitor the descriptor and message the original thread to wake it.)
It seems a kqueue-CFRunLoop would improve efficiency quite a bit at no cost; I've written a lot of code that uses the secondary thread technique, and I know there's a lot of system APIs that do the same (CFFileDescriptor and CFSocket to name a few.)
I did notice that kqueues just gained support for monitoring Mach messages in 10.6 though, so perhaps CFRunLoop has just been waiting for support in the kernel?
David, CFRunLoop has been around for a very long time, since the 10.0 days, well before kqueue was implemented on Mac OS X. I would not be surprised if moving it to a kqueue-based firing mechanism would introduce binary incompatibilities. (Also, I believe that CFMachPort has been around just as long as CFRunLoop; it wasn't just added in Snow Leopard.) In any case, you really want a GCD run loop. -- Damien Sorresso BSD Engineering Apple Inc. _______________________________________________ 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... This email sent to site_archiver@lists.apple.com
participants (1)
-
Damien Sorresso