Re: Newbie exception handler question

briggs_at_encompasserve.org
Date: 12/15/04


Date: 15 Dec 2004 12:35:41 -0600

In article <6g_vd.2109$vJ2.1826@fe07.lga>, Z <z@no.spam> writes:
> JF Mezei wrote:
>> OK, I want a C program to call one of my routines to cleanup stuff under
>> absolutely ALL circumstances, whether it be a <CTRL-C>, <CTRL-Y>, $FORCEX ,
>> divide by 0 or other exception, STOP/ID, power failure, atomic bomb, or
>> unexpected and abrupt end of universe.
>
> AFAIK, you can't see/trap STOP/ID, nor various other possible events,
> like HALTs, BUGCHECKs and system crashes.

Yes, you can trap STOP/ID. You want to install a rundown handler
with a user written system service. Check out SYS$EXAMPLES:UWSS.C

Control-C or control-Y do not, in and of themselves, terminate your
image. So there's no reason to trap them. If the control-Y event
succeeds in returning control to the CLI and the CLI triggers image
exit, the rundown handler will take care of it, even if the command
used at the CLI is "$ STOP". An ordinary exit handler will not be
triggered in the "STOP" case, but will otherwise be adequate to
deal with control-C or control-Y.

$FORCEX is simply a call to $EXIT delivered as an AST. So ordinary
exit handlers can deal with that. As can rundown handlers.

Divide by 0 or other exceptions do not, in and of themselves, cause
image termination. If handled, the handler may cause image exit.
And if unhandled, the default handler ("unhandled condition, image
exit forced") will cause image exit. Either way, either a rundown
handler or an ordinary exit handler will be triggered.

Rundown handlers are unlikely to trap power failure. They are
certainly inadequate to deal with close proximity nuclear detonations
or with the end of the universe.

        John Briggs



Relevant Pages

  • Re: Infinite Loop in ErrorHandler That Requires Hard Shutdown
    ... > others and have come up with the following Exit Handler and Error ... > If bInTrans Then 'Rollback if the transaction is active. ... > I thought I was handling my Error Handling and Exit Handling ...
    (microsoft.public.access.formscoding)
  • Re: Threading Issues (If you can answer this, Ill kiss you.)
    ... sent it is not read from the message queue and your SessionEnding handler is ... On the other hand when you register for the process exit event the system ... process exits a threadpool thread then calls your event handler. ... specifically to handle the broadcast messages. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Flaw in Conditions System?
    ... > | silent on this. ... Unless there's some implicit block I missed. ... consequence of that non-local exit but I'm still in my handler code. ...
    (comp.lang.lisp)
  • funny SIGCHLD behavior
    ... I'm trying to implement a simple shell and am facing some ... SIGCHLD must get sent to the handler. ... to exit. ... * cmdbuf as required by execvfunctions ...
    (comp.unix.programmer)
  • Re: "file locked by another user" mystery
    ... The default ON is "ON ERROR THEN EXIT" ... Many thanks for all the great ideas about $STATUS and $SEVERITY! ... DCL process where these ON conditions can be set to default to ... "ON ERROR THEN EXIT" handler. ...
    (comp.os.vms)