Re: NSURLConnection details
Re: NSURLConnection details
- Subject: Re: NSURLConnection details
- From: "Miguel Coxo" <email@hidden>
- Date: Wed, 13 Feb 2008 11:09:06 +0000
Just wanted to know how many threads cause i will be creating lots of
NSURLConnections.
What i ment by being launch by a NSOperation was: 1 NSOperation is going
to instantiate some NSURLConnections ( 6 or so).
Ok so i guess 1 thread will be ok =).
On Feb 13, 2008 2:15 AM, Jens Alfke <email@hidden> wrote:
>
> 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
--
Cumprimentos, Miguel Coxo.
_______________________________________________
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