|exit(3)||Library Functions Manual||exit(3)|
noreturn void exit(int status);
noreturn void quick_exit(int status);
noreturn void _Exit(int exitcode);
exit() first destroys all objects with C++ thread local storage duration (the C standard leaves whether or not thread local objects are destroyed or not undefined). Next, the destructors of all C++ objects of static storage duration are invoked along with all functions passed to atexit() in reverse order of registration (the time of registration for C++ objects of static storage duration is taken to be the time at which the constructor completes). It then flushes all open FILE streams with unwritten data and closes them. Finally, files created by tmpfile() are removed, before handing control back to the host environment. Note in particular that functions registered with at_quick_exit() are not called.
quick_exit() invokes any functions registered with at_quick_exit() in reverse order of registration, then returns control to the host environment by calling _Exit(). No signal handlers are called, nor are any functions registered with atexit().
_Exit() returns control to the controlling environment without invoking any functions registered by atexit(), at_quick_exit(), any signal handlers, or the destructors of any thread local objects or C++ objects of static storage duration. Whether or not any open FILE streams with unwritten data are flushed or not is undefined.
The result of aborting a call to exit() or quick_exit() by use of longjmp() is undefined. If any function or destructor invoked by exit() or quick_exit() should throw, std::terminate() is invoked.
Undefined behaviour results if, while a call to exit() or quick_exit() is in progress, a call to exit() or quick_exit() is made.
|February 20, 2013||Fusion|