Skip navigation.
 
mlRe: Giving the CPU a break...
FROM : Buzz Andersen
DATE : Thu Nov 21 05:32:30 2002

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