diff options
Diffstat (limited to 'dev/LibC++/base_process.h')
| -rw-r--r-- | dev/LibC++/base_process.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/dev/LibC++/base_process.h b/dev/LibC++/base_process.h index 126ac60..034240f 100644 --- a/dev/LibC++/base_process.h +++ b/dev/LibC++/base_process.h @@ -12,7 +12,10 @@ /// @param code the exit code. /// @return the return > 0 for non successful. extern "C" int exit_(int code); -extern "C" int signal_(int code); + +/// @brief CRT signal handler. +/// @param code the signal code. +extern "C" void signal_(int code); /// @brief Standard C++ namespace namespace std::base_process { @@ -21,7 +24,17 @@ inline int signal(int code) { return -1; } -inline int exit(int code) { +extern "C" void (*__atexit_cdecl_ptr)(void); +extern "C" void (**__atexit_lst_ptr)(void); +extern "C" size_t __atexit_lst_cnt; + +inline int32_t exit(const int32_t& code) { + for (auto idx = 0UL; idx < __atexit_lst_cnt; ++idx) { + __atexit_lst_ptr[idx](); + } + + if (__atexit_cdecl_ptr) __atexit_cdecl_ptr(); + exit_(code); return -1; } |
