• 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: Problems with NSTimer and NSRunLoop/CFRunLoop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with NSTimer and NSRunLoop/CFRunLoop


  • Subject: Re: Problems with NSTimer and NSRunLoop/CFRunLoop
  • From: Mont Rothstein <email@hidden>
  • Date: Thu, 6 Jan 2005 19:14:29 -0800

John and Brendan, thanks for your suggestions.

John,
No, I didn't realize that CF is open source. I may just have to go see if the timer and run loop stuff is.


As Brendan pointed out, the call being made to NSTimer is supposed to add the timer to the run loop for me, and in fact it does in another scenario.

Brendan,
I hadn't even though of a PoseAs, great idea.

I know that the timer has not been added because I have printed our the description for the run loop, which includes all of the modes.

My problem occurs in a process that was created via fork(). Your comment about being in another thread makes me wonder if this could somehow be related. Are you aware of any issues with fork() and NSRunLoops?

Thanks again,
-Mont

On Jan 6, 2005, at 6:45 PM, Brendan Younger wrote:


On Jan 6, 2005, at 8:32 PM, John Stiles wrote:

Unnecessary how?
If you don't attach your timer to a run loop in a mode, it doesn't run, period.

True, but -[NSTimer scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:] automatically adds itself to the current run loop for the default mode. -[NSTimer timerWithTimeInterval:etc.] doesn't add itself and needs to be added manually. The original poster was using -[NSTimer scheduledTimerWithTimeInterval:etc.].


To Mont Rothstein: if "performExpirationCheck:" is meant to be called while a modal window is up in your application, you need to add the timer to the run loop for NSModalPanelRunLoopMode since -[NSTimer scheduledTimerWithTimeInterval:] adds itself for only NSDefaultRunLoopMode.

Brendan Younger

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • continuing after fork() (Re: Problems with NSTimer and NSRunLoop/CFRunLoop)
      • From: Chris Kane <email@hidden>
    • Re: Problems with NSTimer and NSRunLoop/CFRunLoop
      • From: Andrew Farmer <email@hidden>
References: 
 >Problems with NSTimer and NSRunLoop/CFRunLoop (From: Mont Rothstein <email@hidden>)
 >Re: Problems with NSTimer and NSRunLoop/CFRunLoop (From: John Stiles <email@hidden>)
 >Re: Problems with NSTimer and NSRunLoop/CFRunLoop (From: Brendan Younger <email@hidden>)
 >Re: Problems with NSTimer and NSRunLoop/CFRunLoop (From: John Stiles <email@hidden>)
 >Re: Problems with NSTimer and NSRunLoop/CFRunLoop (From: Brendan Younger <email@hidden>)

  • Prev by Date: Cocoa programming-Add control at the run-time
  • Next by Date: A Question about NSFileHandle readDataOfLength:
  • Previous by thread: Re: Problems with NSTimer and NSRunLoop/CFRunLoop
  • Next by thread: Re: Problems with NSTimer and NSRunLoop/CFRunLoop
  • Index(es):
    • Date
    • Thread