Re: Does CFSocket use efficient polling?
Re: Does CFSocket use efficient polling?
- Subject: Re: Does CFSocket use efficient polling?
- From: Josh Graessley <email@hidden>
- Date: Thu, 12 Feb 2009 12:50:30 -0800
On Feb 12, 2009, at 11:25 AM, Scott Ribe wrote:
This is unlikely to be the right
solution for any other apps, especially an app with UI.
I don't know about that. I can imagine many apps where the optimal
solution
might be to read from the stream until an entire message is received,
decompress the message, unmarshall arguments, all in the background
thread
before finally sending the complete message through to the run loop.
I know of at least one GUI application that works this way ;-)
In my experience, there are two good reasons to use a thread:
1) You're CPU bound so you need to utilize multiple cores
2) You're using a poorly designed API - synchronous APIs are a good
example
Most other uses are a waste of resources. Threads do consume
resources. They don't scale (if you need a thousand operations, a
thousand threads are expensive). They cause all sorts of
synchronization issues that most people don't get right and many times
just slow things down.
Beware threads. They're not the friend you think they are.
-josh
_______________________________________________
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