Re: Pausing an NSThread
Re: Pausing an NSThread
- Subject: Re: Pausing an NSThread
- From: Kyle Sluder <email@hidden>
- Date: Sat, 7 Nov 2009 19:36:53 -0800
On Sat, Nov 7, 2009 at 7:28 PM, Ron Fleckner <email@hidden> wrote:
> This is a small proof-of-concept/test kind of project. I've had a look at
> NSConditionLock, but I don't get the concepts. So I've got this naïve
> solution, which is a kind of polling, I know, but it _seems_ to work quite
> well. The CPU usage goes down to zero according to Activity Monitor while
> the thread is 'paused'. That's gotta be a good sign.
No, it just means you didn't screw up in an obvious way. It doesn't
mean you're free of race conditions, corner cases, or other bugs you
haven't tripped on yet.
It would behoove you to read a good introduction to multithreading
that explains condition locks and other threading primitives. The
Cocoa docs expect you to have this foundation already. Unfortunately,
I don't have a link handy. Mind you, even the best tutorial won't
save you from the fact that multithreaded programming is very
difficult, and quite often doesn't get you the results you're looking
for even when done correctly. This is one reason why the Cocoa APIs
favor runloop-based asynchrony over multithreading.
--Kyle Sluder
_______________________________________________
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