Getting rid of boost::mutext on enb singleton class

This commit is contained in:
Pedro Alvarez 2018-03-20 16:53:11 +00:00
parent 2ab25f4c1b
commit 1dd87e5113
1 changed files with 6 additions and 5 deletions

View File

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