20 #ifndef STXXL_EXTERNAL_EXIT_HANDLER
21 #ifndef STXXL_NON_DEFAULT_EXIT_HANDLER
30 return atexit(
function);
41 #else // STXXL_NON_DEFAULT_EXIT_HANDLER
48 mutex exit_handler_mutex;
49 std::vector<void (*)(void)> exit_handlers;
53 scoped_mutex_lock lock(exit_handler_mutex);
54 exit_handlers.push_back(
function);
61 scoped_mutex_lock lock(exit_handler_mutex);
62 while (!exit_handlers.empty()) {
63 (*(exit_handlers.back()))();
64 exit_handlers.pop_back();
70 #endif // STXXL_NON_DEFAULT_EXIT_HANDLER
71 #endif // STXXL_EXTERNAL_EXIT_HANDLER
#define STXXL_BEGIN_NAMESPACE
int register_exit_handler(void(*function)(void))
#define STXXL_END_NAMESPACE