• 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: Terminating an Application ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Terminating an Application ?


  • Subject: Re: Terminating an Application ?
  • From: Chris Ridd <email@hidden>
  • Date: Tue, 05 Nov 2002 07:07:03 +0000

On 5/11/02 3:31 am, Brian Webster <email@hidden> wrote:

> On Monday, November 4, 2002, at 06:26 PM,
> email@hidden wrote:
>
>> My question is, are there any hidden problems associated with
>> terminating an
>> OS X app in this fashion ?
>
> Terminating an application using kill will mean that that application
> won't have any chance to perform cleanup that it normally does on quit,

That is not true. The Unix kill() function simply delivers a signal
asynchronously to the process; how the process reacts to it depends on the
signal it is being sent and what signal handlers that process has set up.

In particular, sending SIGTERM like Alec was doing is the correct way to
tell a process to stop cleanly. (Processes can catch this signal and exit
cleanly.)

Sending SIGKILL will basically shoot the process in the head and give the
poor user experience that you ascribed to all uses of kill() :-)

See the manual pages for kill and signal for more info.

Your posted Applescript snippet might still be the safest way of stopping
GUI apps. I have no idea if Carbon apps typically catch signals or not, or
if Cocoa sets up default signal handlers to handle SIGTERM gracefully or
not.

Given the crappiness of current versions of popular Carbonized apps
(Macromedia apps use lots of CPU while idle, and sit in tight loops when
doing network I/O.) I suspect few set up signal handlers at all.

Cheers,

Chris
_______________________________________________
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: Terminating an Application ?
      • From: Brian Webster <email@hidden>
    • Re: Terminating an Application ?
      • From: Finlay Dobbie <email@hidden>
References: 
 >Re: Terminating an Application ? (From: Brian Webster <email@hidden>)

  • Prev by Date: Calling the same function in multiple classes
  • Next by Date: Re: Cocoa really needs to be thread-safe
  • Previous by thread: Re: Terminating an Application ?
  • Next by thread: Re: Terminating an Application ?
  • Index(es):
    • Date
    • Thread