Re: Does CFSocket use efficient polling?
Re: Does CFSocket use efficient polling?
- Subject: Re: Does CFSocket use efficient polling?
- From: Douglas Davidson <email@hidden>
- Date: Tue, 10 Feb 2009 17:32:49 -0800
On Feb 10, 2009, at 10:11 AM, Josh Graessley wrote:
CFSocket does a stand up job hiding the nasty details of
coordinating between two different sources of events (file
descriptors and mach ports). Unless you're absolutely certain that
CFSocket is the last remaining hotspot in your code, stick with it.
It is not unreasonable to imagine a day when there will be a way for
the system to wait on events for both mach ports and file
descriptors. When/if that day comes, the CFSocket implementation may
adopt the new mechanism and eliminate the extra thread. If you
depend on CFSocket, you will probably get the performance win for
free.
These are very important things to keep in mind. The job of CFSocket
is to provide a way for a socket to act as a run loop source. Exactly
how it does this is an implementation detail, and subject to change in
future releases. If you are making a run loop-based application, and
find that you want to integrate socket handling into it, CFSocket is a
good place to look--or better yet some of the higher-level networking
functionality built on top of it, if that fits your needs. If high-
performance networking is the whole point of your project, and you
need to extract every possible bit of speed, you may wish to program
to the BSD sockets APIs directly. If you're not sure, try the higher-
level APIs first, and move to something else only if it becomes clear
that they are a bottleneck.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden