Re: URL loading system not threadsafe?
Re: URL loading system not threadsafe?
- Subject: Re: URL loading system not threadsafe?
- From: Jerry Krinock <email@hidden>
- Date: Sat, 19 Nov 2005 07:32:02 -0800
- Thread-topic: URL loading system not threadsafe?
on 05/11/19 00:52, Henk Kampman at email@hidden wrote:
>
> On 19-nov-2005, at 0:04, Jerry Krinock wrote:
>
>> In the meantime Henk, if you get a chance, try your app on a
>> single-processor Mac and see if it still blows.
>
> I was already suspecting that this was MP related so I tried an iMac
> G5, and guess what? no crashes whatsoever!
In that case, I'd say it is probably that you and I are dealing with the
same bug. And I do not do any multithreading in my app, although I can see
from watching for number "Threads: nnn" near the bottom of the Activity
Monitor, that, as you found in the documentation, URL Loading System is
indeed spawning one thread for each of my NSURLConnections.
Now, the URL loading system may indeed not be thread-safe as argued by other
posters. But you don't need to fight that battle. Instead of sending
-dataWithContentsOfURL to NSData, create an asynchronous request by sending
connectionWithRequest:delegate to NSURLConnection. You can create your 8
NSURLConnections this way, then sit back and wait for your delegates to
collect the data. The multithreading is done under the hood for you, by the
URL Loading System!
Having said all that, if indeed you and I are dealing with the same bug,
you're still going to get crashes when you release the delegates...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden