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

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.
References: 
 >NSTimer "takes over" CPU everytime it repeats? (From: Hisaoki Nishida <email@hidden>)

  • Prev by Date: NSTimer "takes over" CPU everytime it repeats?
  • Next by Date: Re: NSTimer "takes over" CPU everytime it repeats?
  • Previous by thread: NSTimer "takes over" CPU everytime it repeats?
  • Next by thread: Re: NSTimer "takes over" CPU everytime it repeats?
  • Index(es):
    • Date
    • Thread