Re: NSURL and thread proliferation
Re: NSURL and thread proliferation
- Subject: Re: NSURL and thread proliferation
- From: Wade Tregaskis <email@hidden>
- Date: Sat, 5 Jun 2004 12:10:42 +1000
I just noticed that my single threaded app suddenly becomes a 5 thread
app when I call NSString's stringWithContentsOfURL: method. It looks
like the additional threads are due to the machinations of NSURL and
stuff, but what mystifies me is why most of the new threads hang
around even after all the work is done.
One thread is often for the audio HAL - even though that's not really
in AppKit, I guess NSSound spawns it. You'll often find one thread is
some sort of asynchronous event manager, which just sits in it's
runloop and does nothing in particular that I've noticed. Then of
course there's various threads for the actual socket stuff - two if I
remember rightly.
So there's your extra 4, although it probably varies a bit.
Generally it's not worth thinking about, because these extra threads
are by and large just sleepers, and won't use any processor time nor
any significant memory. It's probably not worth shutting them down for
this very reason - it's safer to assume you need them all the time than
to not, and then incur heavy penalties for thread creation when you do.
Also, one thread I see a lot just calls EnterMovies or whatever the
QuickTime "runloop" function is. I'm not sure how that ties in to
AppKit; it might be a result of another framework. It does tend to
take up a noticeable amount of CPU time, even when you're not using
QuickTime... I guess it's in a loose loop, so it has to run every now
and again.
Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.