• 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 in main NSRunLoop v. InstallEventLoopTimer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer in main NSRunLoop v. InstallEventLoopTimer


  • Subject: Re: NSTimer in main NSRunLoop v. InstallEventLoopTimer
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 10 Sep 2008 10:04:42 -0500

On Sep 10, 2008, at 4:19 AM, Wesley Smith wrote:

I'm trying to figure out how I can have my app run a timer that never
suspends when the user interacts with menus and the like.

You can use -[NSRunLoop addTimer:forMode:] to schedule the timer on additional run-loop modes. You might want to use NSEventTrackingRunLoopMode, for example.


Whether this is a good idea or not is another question. Remember, no matter what mode(s) a timer is scheduled in, there's no guarantee that it will fire at any given rate. At any given moment, the application may not be idle in its event loop -- it might be doing processing or handling some other event. Also, depending on what you're doing in response to the timer firing, it might not be appropriate during menu tracking, etc. So, depending on what you're trying to achieve, you may be asking the wrong question.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTimer in main NSRunLoop v. InstallEventLoopTimer
      • From: "Wesley Smith" <email@hidden>
References: 
 >NSTimer in main NSRunLoop v. InstallEventLoopTimer (From: "Wesley Smith" <email@hidden>)

  • Prev by Date: RE: Cocoa-dev Digest, Vol 5, Issue 1598
  • Next by Date: EPS
  • Previous by thread: NSTimer in main NSRunLoop v. InstallEventLoopTimer
  • Next by thread: Re: NSTimer in main NSRunLoop v. InstallEventLoopTimer
  • Index(es):
    • Date
    • Thread