_execute_onexit_table、_initialize_onexit_table、_register_onexit_function_execute_onexit_table, _initialize_onexit_table, _register_onexit_function

管理在退出时要调用的例程。Manages the routines to be called at exit time.

语法Syntax

int _initialize_onexit_table(  
    _onexit_table_t* table  
    );  

int _register_onexit_function(  
    _onexit_table_t* table,  
    _onexit_t        function  
    );  

int _execute_onexit_table(  
    _onexit_table_t* table  
    );  

参数Parameters

[inout]table[inout] table
指向 onexit 函数表的指针。Pointer to the onexit function table.

[in] function[in] function
指向一个函数以添加到 onexit 函数表的指针。Pointer to a function to add to the onexit function table.

返回值Return Value

如果成功,则返回 0。If successful, returns 0. 否则,返回一个负值。Otherwise, returns a negative value.

备注Remarks

这些函数是用来支持 C 运行时的基础结构实现详细信息,不应在代码中直接调用。These functions are infrastructure implementation details used to support the C runtime, and should not be called directly from your code. C 运行时使用 onexit 函数表来表示通过调用 atexitat_quick_exit,和 _onexit 注册的函数序列。The C runtime uses an onexit function table to represent the sequence of functions registered by calls to atexit, at_quick_exit, and _onexit. onexit 函数表数据结构是 C 运行时的非跳转实现详细信息;可以更改此数据成员的顺序和含义。The onexit function table data structure is an opaque implementation detail of the C runtime; the order and meaning of its data members may change. 它们不应由外部代码进行检查。They should not be inspected by external code.

_initialize_onexit_table 函数将 onexit 函数表初始化为其初始值。The _initialize_onexit_table function initializes the onexit function table to its initial value. 将 onexit 函数表传递给 _register_onexit_function_execute_onexit_table 前,必须调用此函数。This function must be called before the onexit function table is passed to either _register_onexit_function or _execute_onexit_table.

_register_onexit_function 函数在 onexit 函数表的末尾追加一个函数。The _register_onexit_function function appends a function to the end of the onexit function table.

_execute_onexit_table 函数执行 onexit 函数表中的所有函数,并清除表,然后返回。The _execute_onexit_table function executes all of the functions in the onexit function table, clears the table, and then returns. 在调用 _execute_onexit_table 后,表处于无效状态;必须通过调用 _initialize_onexit_table 以对其重新初始化后才能再次使用。After a call to _execute_onexit_table, the table is in a non-valid state; it must be reinitialized by a call to _initialize_onexit_table before it is used again.

要求Requirements

例程Routine 必需的标头Required header
_initialize_onexit_table function, _register_onexit_function, _execute_onexit_table_initialize_onexit_table function, _register_onexit_function, _execute_onexit_table C, C++: <process.h>C, C++: <process.h>

_initialize_onexit_table_register_onexit_function_execute_onexit_table 函数是 Microsoft 特定函数。The _initialize_onexit_table, _register_onexit_function, and _execute_onexit_table functions are Microsoft specific. 有关兼容性信息,请参阅兼容性For compatibility information, see Compatibility.

另请参阅See Also

atexit atexit
exit、_Exit、_exit exit, _Exit, _exit
_onexit、_onexit_m_onexit, _onexit_m