Re: How to tell if system shutdown is in process
Re: How to tell if system shutdown is in process
- Subject: Re: How to tell if system shutdown is in process
- From: James C <email@hidden>
- Date: Sat, 26 Mar 2011 10:57:52 +1300
I don't know if the output from the long-running job can be reduced to
a file on the file-system. If it can, then the atomicity mechanism
that I like a lot is rename(), and the cleanup on restart is to
compare the contents of directories (eg by piping ls-1 into while
read) and remove any partially generated output.
Regards,
James.
> Message: 2
> Date: Thu, 24 Mar 2011 19:21:35 -0700
> From: Michael Smith <email@hidden>
> Subject: Re: How to tell if system shutdown is in process
> To: Jerry Krinock <email@hidden>
> Cc: "email@hidden Kernel"
> <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="us-ascii"
>
>
> On Mar 24, 2011, at 10:27 AM, Jerry Krinock wrote:
>
>> I want my non-GUI command-line program which is launched by user-level launchd to know as early as possible when shutdown is occuring, preferably (for example, if initiated by the console user) immediately when the user clicks the "Shut Down" button in the confirmation dialog, and, at least, before SIGTERMs start getting sent to processes. NSWorkspaceWillPowerOffNotification doesn't work, and IORegisterForSystemPower() doesn't work. Alternatively, I'd like an API to which I could ask before beginning a long task, "Is shutdown in progress?"
>
>
> You should not do this, because what you are actually asking is "will shutdown be initiated during my long task", which is not something that can be answered.
>
> Instead, you should ask yourself "how can I safely and quickly abort my long task in the rare circumstance where shutdown is signalled while it is in progress?".
>
> = Mike
>
> --
> Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile -- Hippocrates
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden