NSTimer "takes over" CPU everytime it repeats?
NSTimer "takes over" CPU everytime it repeats?
- Subject: NSTimer "takes over" CPU everytime it repeats?
- From: Hisaoki Nishida <email@hidden>
- Date: Tue, 22 Oct 2002 18:23:01 -0400
Hi,
I am trying to use NSTimer to fire a method in my server code.
The method basically looks for a client connection and handles it
accordingly.
Because I need 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. I know this shouldn't be
happening. I used an OpenGL draw function (in Cocoa API I think) as the
selector before in a different app and it worked fine (no GUI
stuttering or anything).
What am I doing wrong? Am I supposed to use a second thread for my
timer, so it doesn't interfere with my other threads? How would I do
this?
Thank you,
-Yuki
_______________________________________________
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.