_Exit() and signal handlers

S

Spiros Bousbouras

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 ?
 
R

Richard Bos

Spiros Bousbouras said:
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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top