Re: NSURLConnection details
Re: NSURLConnection details
- Subject: Re: NSURLConnection details
- From: Jens Alfke <email@hidden>
- Date: Tue, 12 Feb 2008 18:15:42 -0800
On 12 Feb '08, at 4:34 PM, Miguel Coxo wrote:
Does he create more than one thread? If so how many?
Foundation and CFNetwork create a single background thread for async
network I/O.
When something happens, that thread posts a message to the main
thread's runloop, which calls your delegate methods.
So as far as you're concerned, everything is happening on a single
thread.
Also the method that creates all the NSURLDataReceivers/
NSURLConnections
will be invoked from a NSOperation, will this be a problem?
By default, each NSOperation runs its -main method on a separate
thread. That's overkill in your case since the calls the operation
makes will be asynchronous anyway, and it'll complicate your code
because you may well have to deal with thread-safety. I'd advise
overriding -start in your NSOperation subclass to make it the type of
operation that doesn't create a thread (read the NSOperation docs for
details.)
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden