_Exit() and signal handlers

Discussion in 'C Programming' started by Spiros Bousbouras, Jun 26, 2007.

  1. 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 ?
     
    Spiros Bousbouras, Jun 26, 2007
    #1
    1. Advertisements

  2. Spiros Bousbouras

    Richard Bos Guest

    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
     
    Richard Bos, Jun 26, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.