• 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: Wed, 20 Nov 2002 21:32:30 -0700

Hrm? I want to know why not. Anyone know how NSThread maps into the Unix priorities of [-20,20]? Or is this Mach stuff? I would have expected +setPriority: to do the trick.

+setPriority is indeed what I'm using. I honestly have never really noticed much appreciable difference whether it is set to 0.1 or 1--either way, my rogue loop seems to consume the processor time voraciously :-).

Incidentally, I should add (again, for the benefit of future cocoa.mamasam.com searchers) that simply using NSThread +sleepUntilDate after a fixed number of operations may not be the smartest idea (a very helpful soul from the list has pointed this out to me). That approach has problems in that it doesn't scale up to faster processors--essentially, the actual operations that the loop performs take less and less time, while more and more clock cycles are wasted on sleep! A better approach is to take a time base and wait to sleep until a certain amount of time (as opposed to a fixed number of operations) past that time base to actually sleep. Just wanted to point that out...

--
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: Ondra Cada <email@hidden>
References: 
 >Re: Giving the CPU a break... (From: Alex Rice <email@hidden>)

  • Prev by Date: using NSFileWrapper
  • Next by Date: Re: how to crash on normally ignored exceptions
  • Previous by thread: Re: Giving the CPU a break...
  • Next by thread: Re: Giving the CPU a break...
  • Index(es):
    • Date
    • Thread