X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Finclude%2Fon_exit.h;fp=src%2Fceph%2Fsrc%2Finclude%2Fon_exit.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=6510feffb9c2bfcc9559bf65cc80ab30545fe2f5;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/include/on_exit.h b/src/ceph/src/include/on_exit.h deleted file mode 100644 index 6510fef..0000000 --- a/src/ceph/src/include/on_exit.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef CEPH_ON_EXIT_H -#define CEPH_ON_EXIT_H - -#include -#include -#include - -/* - * Create a static instance at the file level to get callbacks called when the - * process exits via main() or exit(). - */ - -class OnExitManager { - public: - typedef void (*callback_t)(void *arg); - - OnExitManager() { - int ret = pthread_mutex_init(&lock_, NULL); - assert(ret == 0); - } - - ~OnExitManager() { - pthread_mutex_lock(&lock_); - std::vector::iterator it; - for (it = funcs_.begin(); it != funcs_.end(); it++) { - it->func(it->arg); - } - funcs_.clear(); - pthread_mutex_unlock(&lock_); - } - - void add_callback(callback_t func, void *arg) { - pthread_mutex_lock(&lock_); - struct cb callback = { func, arg }; - funcs_.push_back(callback); - pthread_mutex_unlock(&lock_); - } - - private: - struct cb { - callback_t func; - void *arg; - }; - - std::vector funcs_; - pthread_mutex_t lock_; -}; - -#endif