1 .\" This file is part of the Public Domain C Library (PDCLib).
2 .\" Permission is granted to use, modify, and / or redistribute at will.
10 .Nd registration of functions to be invoked before process termination
14 .Fn "int atexit" "void (*handler)(void)"
15 .Fn "int at_quick_exit" "void (*handler)(void)"
19 These functions register a function to be called when the corresponding process
20 exit function is invoked. For
22 the function will be invoked when the process is terminated by calling
26 the function will be invoked when the process is terminated by calling
30 These functions are used in order to permit a program to perform actions before
31 a process is terminated; for example, releasing an interprocess semaphore.
32 Special care should be taken when writing
34 handlers; the purpose of
36 is to support the abandonning of a process when normal process termination might
37 not be possible; at_quick_exit handlers should therefore be used sparingly and
38 only when their use is essential.
41 The standard guarantees that
45 may each be called at least 32 times successfully.
51 handlers are called in reverse order of the order they were registered in. For
52 precise details of their ordering, see
56 The result of exiting from a handler registered with
62 is undefined. If any function or destructor invoked by
71 Undefined behaviour results if an
81 Returns 0 to indicate success; nonzero returns indicate failure.
100 ISO/IEC 14882:2011 "C++ 2011" .