21 #ifndef STXXL_EXTERNAL_EXIT_HANDLER
22 #ifndef STXXL_NON_DEFAULT_EXIT_HANDLER
31 return atexit(
function);
42 #else // STXXL_NON_DEFAULT_EXIT_HANDLER
49 mutex exit_handler_mutex;
50 std::vector<void (*)(void)> exit_handlers;
54 scoped_mutex_lock lock(exit_handler_mutex);
55 exit_handlers.push_back(
function);
62 scoped_mutex_lock lock(exit_handler_mutex);
63 while (!exit_handlers.empty()) {
64 (*(exit_handlers.back()))();
65 exit_handlers.pop_back();
71 #endif // STXXL_NON_DEFAULT_EXIT_HANDLER
72 #endif // STXXL_EXTERNAL_EXIT_HANDLER
#define STXXL_BEGIN_NAMESPACE
int register_exit_handler(void(*function)(void))
#define STXXL_END_NAMESPACE