Re: _Exit() and signal handlers



Spiros Bousbouras <spibou@xxxxxxxxx> wrote:

In 7.20.4.4 of n1124 we read:

The _Exit function causes normal
program termination to occur and
control to be returned to the host
environment. No functions registered
by the atexit function or signal handlers
registered by the signal function are called.

Why is there a mention of signal handlers ? I
mean exit() doesn't call signal handlers either
and you wouldn't expect any library function
to call signal handlers unless it is explicitly
mentioned that it does. So why is there a need
to specify in this case that it does *not* call
signal handlers ?

Even in ISO C, the program can be set to catch SIGABRT. Though this in
itself does not justify that sentence, the implementation is free to
implement other signals; for example, it might implement a SIGEXIT
similar to SIGABRT, but occuring on normal rather than abnormal
termination. In that case, exit() would trigger it, but _Exit() must
not.

Richard
.



Relevant Pages

  • Re: BEGIN, INIT etc...
    ... Sorry, that's my mistake: exec() never returns, unless it fails, and I ... also want to set up signal handlers to pass signals along, ...
    (comp.lang.perl.misc)
  • Re: Shell Scripts Exit with out any apparent reason
    ... > I have few K shell scripts which run in the background. ... > mins). ... these scripts just exit. ... It'd suggest to include signal handlers and traps for ...
    (comp.unix.solaris)
  • Re: Two question about signal handlers
    ... >is possible while remaining ISO C compliant. ... >to call _Exit() from signal handlers which may be called asynchronously? ... Balmer Consulting ...
    (comp.lang.c)