Linux-atexit () (Registration termination) function

Source: Internet
Author: User

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.