Getting rid of boost::mutext on enb singleton class

master
Pedro Alvarez 7 years ago
parent 2ab25f4c1b
commit 1dd87e5113

@ -32,26 +32,27 @@
namespace srsenb { namespace srsenb {
enb* enb::instance = NULL; enb* enb::instance = NULL;
boost::mutex enb_instance_mutex; pthread_mutex_t enb_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
enb* enb::get_instance(void) enb* enb::get_instance(void)
{ {
boost::mutex::scoped_lock lock(enb_instance_mutex); pthread_mutex_lock(&enb_instance_mutex);
if(NULL == instance) { if(NULL == instance) {
instance = new enb(); instance = new enb();
} }
pthread_mutex_unlock(&enb_instance_mutex);
return(instance); return(instance);
} }
void enb::cleanup(void) void enb::cleanup(void)
{ {
srslte_dft_exit(); srslte_dft_exit();
srslte::byte_buffer_pool::cleanup(); srslte::byte_buffer_pool::cleanup();
boost::mutex::scoped_lock lock(enb_instance_mutex); pthread_mutex_lock(&enb_instance_mutex);
if(NULL != instance) { if(NULL != instance) {
delete instance; delete instance;
instance = NULL; instance = NULL;
} }
pthread_mutex_unlock(&enb_instance_mutex);
} }
enb::enb() : started(false) { enb::enb() : started(false) {

Loading…
Cancel
Save