• 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, no invalidate while shutting down?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTimer, no invalidate while shutting down?


  • Subject: NSTimer, no invalidate while shutting down?
  • From: Tom Harrington <email@hidden>
  • Date: Fri, 23 Jan 2004 12:38:37 -0700

I have a situation where -[NSTimer invalidate] appears to be a bad idea, but I don't really understand why.

I use an NSTimer to periodically call a method. When the app is exiting, its cleanup method includes calling [myTimer invalidate]. Normally this is fine and works as expected. But there's one exception: If the app is running on Panther when the system is shutting down, the call to -invalidate blocks and never seems to return. Logged in remotely, I can also see that the app draws 90% of CPU or more when this is happening. After 30 seconds or so the OS apparently gives up and just destroys the process or something.

[I narrowed down the problem to the -invalidate call first by printing lots of messages to a file, since it's tricky to debug a process when the system's trying to shut down. I confirmed it by removing the call to -invalidate and observing that the problem disappears.]

This does not happen on Jaguar. It also doesn't happen on Panther in any other situation. I tried simulating the situation by doing a "kill -TERM pid", since that's the signal it gets at shutdown time, but in that case -invalidate returns normally.

Given the symptoms, should I not be calling -invalidate when the system is shutting down? And how would I know? I could just completely remove the -invalidate call, but I thought it was part of cleaning up the timer properly.

--
Tom Harrington
email@hidden
_______________________________________________
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, no invalidate while shutting down?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: NSXMLParserTroubles (errors and line/column positions wrong?)
  • Next by Date: Re: XCode annoyance :-\
  • Previous by thread: Re: CURLHandle example code?
  • Next by thread: Re: NSTimer, no invalidate while shutting down?
  • Index(es):
    • Date
    • Thread