• 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
NSTimer "takes over" CPU everytime it repeats?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: NSTimer "takes over" CPU everytime it repeats?
      • From: Cameron Hayne <email@hidden>
    • Re: NSTimer "takes over" CPU everytime it repeats?
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: NSScanner bug?
  • Next by Date: Re: NSTimer "takes over" CPU everytime it repeats?
  • Previous by thread: Re: [ANN] Cocoa Developer Meeting Place
  • Next by thread: Re: NSTimer "takes over" CPU everytime it repeats?
  • Index(es):
    • Date
    • Thread