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: Ondra Cada <email@hidden>
- Date: Wed, 23 Oct 2002 00:39:59 +0200
On Wednesday, October 23, 2002, at 12:23 , Hisaoki Nishida wrote:
Because I need it running all the time
Well if you want it running all the time...
, not interfering with user
interaction, I do this:
selectTimer = [[NSTimer scheduledTimerWithTimeInterval:0.0
target:self selector:@selector(run)
userInfo:nil repeats:YES] retain];
[[NSRunLoop currentRunLoop] addTimer:selectTimer
forMode:NSEventTrackingRunLoopMode];
The problem is my timer just takes over CPU and completely suspends
user interaction with GUI within the app.
... you should not be surprised it runs all the time.
Most probably you actually want to use a time interval of something like
.1, .3, .5 -- depends on the task. If that is not what you want, then you
want another thread. Tertium, so far as I know, non datur.
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.