Added some boieler plate code for the MME (contruct, singleton, destruct).

master
Pedro Alvarez 7 years ago
parent b0aaa316c4
commit 136e3a2697

@ -33,10 +33,17 @@
#ifndef MME_H
#define MME_H
#include <cstddef>
namespace srsepc{
class mme
{
public:
mme* get_instance(void);
void cleanup(void);
private:
static mme *instance;

@ -24,13 +24,38 @@
*
*/
#include <boost/thread/mutex.hpp>
#include "mme/mme.h"
namespace srsepc{
mme* mme::instance = NULL;
boost::mutex mme_instance_mutex;
mme*
mme::get_instance(void)
{
boost::mutex::scoped_lock lock(mme_instance_mutex);
if(NULL == instance) {
instance = new mme();
}
return(instance);
}
mme::mme()
{
}
void
mme::cleanup(void)
{
boost::mutex::scoped_lock lock(mme_instance_mutex);
if(NULL != instance) {
delete instance;
instance = NULL;
}
}
} //namespace srsepc

Loading…
Cancel
Save