• 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: applicationWillTerminate and asynchronous orderly shutdown
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applicationWillTerminate and asynchronous orderly shutdown


  • Subject: Re: applicationWillTerminate and asynchronous orderly shutdown
  • From: "Hamish Allan" <email@hidden>
  • Date: Tue, 10 Jun 2008 21:41:21 +0100

On Tue, Jun 10, 2008 at 9:12 PM, Stuart Malin <email@hidden> wrote:

> I have an app that establishes multiple TCP connections. If the user quits
> the app, I'd like to shut all those connections gracefully (i.e., conduct a
> bit of protocol) rather than just close them abruptly. To most properly
> handle this, I should even wait for the servers' responses.  I am currently
> initiating the graceful shutdown in applicationWillTerminate  but... how
> should I best wait for the connections to close: spin in a loop and check
> them? and set a timer for a timeout?  Or, is there another way to more
> properly handle asynchronous activity at application termination?

You could override applicationShouldTerminate:, return
NSTerminateLater, and then call replyToApplicationShouldTerminate:
when you've finished shutting down your connections. (You should
probably also give the user the option to "Terminate Now".)

Hamish
_______________________________________________

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

References: 
 >applicationWillTerminate and asynchronous orderly shutdown (From: Stuart Malin <email@hidden>)

  • Prev by Date: Re: Updating a progress bar from a code loop
  • Next by Date: Re: Prevent Asynchronous operation of beginSheetModalForWindow
  • Previous by thread: applicationWillTerminate and asynchronous orderly shutdown
  • Next by thread: Mail Rule Actions Control
  • Index(es):
    • Date
    • Thread