• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Giving the CPU a break...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Giving the CPU a break...


  • Subject: Giving the CPU a break...
  • From: Buzz Andersen <email@hidden>
  • Date: Mon, 18 Nov 2002 12:04:33 -0700

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@hidden
web: http://www.scifihifi.com
_______________________________________________
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.

  • Follow-Ups:
    • Re: Giving the CPU a break...
      • From: Sherm Pendley <email@hidden>
    • Re: Giving the CPU a break...
      • From: Alex Rice <email@hidden>
    • Re: Giving the CPU a break...
      • From: Kevin Elliott <email@hidden>
    • Re: Giving the CPU a break...
      • From: Buzz Andersen <email@hidden>
  • Prev by Date: up/down arrow action in a table
  • Next by Date: Re: Close button on Single Window Utilities
  • Previous by thread: Re: up/down arrow action in a table
  • Next by thread: Re: Giving the CPU a break...
  • Index(es):
    • Date
    • Thread