Re: NSTimer "takes over" CPU everytime it repeats?
Re: NSTimer "takes over" CPU everytime it repeats?
- Subject: Re: NSTimer "takes over" CPU everytime it repeats?
- From: Nat! <email@hidden>
- Date: Sun, 27 Oct 2002 11:48:26 +0100
Am Sonntag, 27.10.02 um 01:54 Uhr schrieb James DiPalma:
From: Cameron Hayne <email@hidden>
And by the way, it is slightly misleading to say that your "timer
takes over
the CPU" - it isn't the timer but rather the code that is executed
when the
timer fires that is taking over the CPU.
If you look at Hisaoki's timer, it might just be his timer that takes
over the CPU.
From: Hisaoki Nishida <email@hidden>
selectTimer = [[NSTimer scheduledTimerWithTimeInterval:0.0
target:self selector:@selector(run)
userInfo:nil repeats:YES] retain];
I created an NSTimer just like this and called a method that does
nothing and my sample app doing nothing but fire this timer in a
background thread took over 50% of my CPU. Ondra's suggestion of
adding a small time interval might help.
But what do you expect ? I would assume that the timer is firing
incessantly, and someone needs to execute the NSTimer and the "run"
code. That's going to be the CPU.... It's not really much different
from writing for(;;) [self run];
Ciao
Nat!
------------------------------------------------------
I was hoping that the people of the world might be
united by something more interesting, like drugs or an
armed struggle against the undead. Unfortunately my
father's team won, so computers it is. -- Sedaris
_______________________________________________
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.