• 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
Re: Giving the CPU a break...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Giving the CPU a break...


  • Subject: Re: Giving the CPU a break...
  • From: Buzz Andersen <email@hidden>
  • Date: Mon, 18 Nov 2002 15:09:51 -0700

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?

A follow-up: I've experimented a bit with using the thread sleep approach, and it seems to work reasonably well. According to top, my processor utilization never really gets above 40%. I simply put the following code at the bottom of my loop:

[NSThread sleepUntilDate: [[NSDate date] addTimeInterval: .01]];

Not a big deal--I just wanted to post that for generations of future cocoa.mamasam.com searchers who might have the same question :-).

I would still be interested to know about alternative approaches if anyone has any better ideas...

--
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.

References: 
 >Giving the CPU a break... (From: Buzz Andersen <email@hidden>)

  • Prev by Date: Re: [OT] jobs?
  • Next by Date: Re: First cocoa app & crashes
  • Previous by thread: Giving the CPU a break...
  • Next by thread: Re: Giving the CPU a break...
  • Index(es):
    • Date
    • Thread