5 ways to terminate a process Q Normal Exit Q returns from the main function Q Call Exit Q Call _exit Q Abnormal exit Q Call abort to generate Sigabout signal Q Stop by signal CTRL + C SIGINT |
|
eg Difference 1: Emptying the buffer operation int main (void) { printf ("Hello Itcast"); return 0; Exit (0); Fflush (stdout); _exit (0); } Difference 2:exit Call Termination handler About terminating handlers |
Q atexit can register a termination handler, and ANSI c specifies that up to 32 termination handlers can be registered. Q Termination Handler's call is reversed from the registration order Q Mans atexit int atexit (void (*function) (void)); Mans 2 Atexit |
Summarize exit and _exit differences 1) _exit is a system call, Exit is a C library function 2) Exit performs a clear I/O cache 3) exit executes the call termination handler |
Copy to Google TranslateTranslation Results
[Learning Notes] 5 ways to terminate a process