Reclaim process user space resource exit () function _ exit () function atexit () function on_exit () function, _ exitatexitAbstract:This article describes how to terminate a process and how to use the exit () function to terminate the process and
Abstract:This article describes how to terminate a process and how to use the exit () function to terminate the process and reclaim the user space resources of the process. It analyzes the exit () function and the _ exit () function, difference in
Note: Exit () is exited, the parameters passed in is the program exit status code, 0 for normal exit, the other means the abnormal exit, generally used-1 or 1, standard C has exit_success and exit_failure two macros, with exit (exit_success) ,
Exit () ends the current process/current program/. In the whole program, it ends when exit is called.
Return () is the return of the current function. Of course, if it is in the main function, the current process is naturally ended. If it is not, it
The exit and _ exit functions are used to terminate a program normally: _ Exit immediately enters the kernel, and exit is used to execute some cleanup operations (including calling and executing various termination processes, close all standard I/O
The use of the Exit function in C languageExit () End the current process/current program/, in the entire program, as long as the exit is called, the endReturn () is the current function return, of course, if it is in the main function main, it will
Differences between exit () and _ exit ()
Linux source code
# DEFINE _ nr_exit 1
# DEFINE _ nR _ exit _ nr_exit/* from the File Include/asm-i386/unistd. H */"_ NR _" is the prefix for each system call in the Linux source code. Note that there are
Exit () End the current process/current program/, in the entire program, as long as the exit is called, the endReturn () is the current function return, of course, if it is in the main function main, it will naturally end the current process, if not,
The exit and exit status codes exit are used to end a script, just like in C. it also returns a value, which is passed to the parent process of the script. The parent process uses this value for further processing. each command returns an exit
I have been engaged in Android development for some time. I believe that many Android programmers developed from Windows will habitually encounter the same problem as me: how to exit the program completely? My own experience is not authoritative and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.