• 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: Killing child tasks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Killing child tasks


  • Subject: Re: Killing child tasks
  • From: Phillip Morelock <email@hidden>
  • Date: Wed, 05 Jun 2002 12:14:32 -0700

On 6/5/02 4:07 AM, "Will Thimbleby" <email@hidden> wrote:

> Hi,
>
> I am using NSTasks to access other programs through standard
> input/output. This all works, however if the user force-quits my
> program, the tasks continue to run, unnoticed in the background using
> processor power. Is there a way to ensure the child tasks are attached
> to the main program so that when it exits the child tasks are forced to
> exit as well.

<newbie who knows unix but not cocoa who probably shouldn't be giving
advice>
I am not sure if you can do this in a Cocoa program, but you can register a
signal handler (Unix-style, baby) for Unix apps and when the OS sends a kill
signal you will be able to run a routine. (Sort of like an interrupt
handler). see man kill and man sigaction for more information. Although I
don't know what signal gets sent when the cmd-opt-esc kill is used. Anyone?

I would keep a linked list of all the processes you've started, or something
like that...then you can just iterate the list and kill if necessary.

> Also: Is there an easy way to get them to run as nice, so that other
> programs still have priority.

Probably --- I don't know NSTask but do you feed it a command string? Does
it get interpreted as a sh / tcsh expression? If so this shouldn't be too
hard. see man renice and man nice

> Cheers
>
> Will

fillup

> _______________________________________________
> 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.
_______________________________________________
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: Killing child tasks
      • From: email@hidden
References: 
 >Killing child tasks (From: Will Thimbleby <email@hidden>)

  • Prev by Date: Re: Next-Dev-Tools on other Systems
  • Next by Date: Re: Thread safe programming
  • Previous by thread: Killing child tasks
  • Next by thread: Re: Killing child tasks
  • Index(es):
    • Date
    • Thread