There are 8 types of process, the first 5 are normal end, and the last three are abnormal end?:
1, return from main function;
2, adjust the Exit function;
3, tune _exit or _exit;
4. The last thread returns from the start routine;
5, the last of the thread tune Pthread_exit;
6, adjust the abort function;
7, receive a signal and end?
8. The last thread responds to a cancellation request.
Atexit () function: The function that is called after the end of the main execution is the registration termination function.
Its prototype is a null return value, a function pointer whose return value is null, and void Atexit (*func) (void).
Head required for use: #include <stdlib.h>
Features of the atexit () function call:
1), exit calls the registration function in the same order as when they were registered, such as: the Order of the functions at the time of registration is a,b,c,d,e,f, then the order that exit calls them is f,e,d,c,b,a;
2), if the same function is registered multiple times, it will also be called multiple times.
Linux-atexit () (Registration termination) function