Re: Crash in CFReadStreamOpen
Re: Crash in CFReadStreamOpen
- Subject: Re: Crash in CFReadStreamOpen
- From: Jens Alfke <email@hidden>
- Date: Thu, 28 May 2009 07:35:49 -0700
On May 28, 2009, at 6:49 AM, Benoit Foucher wrote:
It's actually not clear to me how I'm supposed to use run loops if
the APIs aren't thread safe or why the different methods to register
a source with a run loop provide a run loop parameter.
I'll have to defer to the Apple people here who know about the innards
of CFRunLoop.
Suppose I want a thread pool to handle IO for multiple network
connections (either using the CFSocket or CFStream APIs). How can I
register the network connections with the run loop of each thread
from the pool?
If you're using a thread per connection you probably don't need or
want async I/O — so skip the runloop stuff and just use the read/write
calls in blocking mode.
The usual design when using CFStreams with runloops is to do
everything on one thread, and handle asynchronous events as they happen.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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