Skip navigation.
 
mlGiving the CPU a break...
FROM : Buzz Andersen
DATE : Mon Nov 18 20:04:33 2002

This is probably a terribly obvious rookie question, but I'll ask it
any way.  A program I am working on contains a very tight loop that can
often run through many thousands of iterations at a time.  As you might
expect, this is having a tendency to really max out my CPU usage and
make my computer very unresponsive.

My question is: is there a good way for me to give the CPU a break and
make the computer more responsive during this loop without compromising
performance significantly?  I have tried moving my thread priority down
to 0.1, but that doesn't seem to make a difference.  Would NSThread's
sleepUntilDate: methods be what I'm looking for?  If so, how long do
you think I would need to sleep to really alleviate the problem without
compromising performance too much?  Or, alternatively, is there a
better way to accomplish what I'm trying to do (this way seems a little
hacky to me)?

Thanks, as always, for everyone's expertise...

--
Buzz Andersen
email: <email_removed>
web: http://www.scifihifi.com
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlGiving the CPU a break... Buzz Andersen Nov 18, 20:04
mlRe: Giving the CPU a break... Buzz Andersen Nov 18, 23:09
mlRe: Giving the CPU a break... Kevin Elliott Nov 19, 18:33
mlRe: Giving the CPU a break... Alex Rice Nov 20, 02:05
mlRe: Giving the CPU a break... Sherm Pendley Nov 20, 05:00
mlRe: Giving the CPU a break... Ryan Stevens Nov 20, 16:57
mlRe: Giving the CPU a break... Buzz Andersen Nov 21, 05:32
mlRe: Giving the CPU a break... Ondra Cada Nov 21, 15:02