You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#include "IM_Kernel.h"
#include "IM_ClientHandler.h"
#define LOG( X ) m_pLog->Log( "KRNL", this, X )
#ifdef DEBUG
#define LOG_ERROR( X ) {\
char _tBfrErrMSG234[256];\ sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ m_pLog->Log( "KRNL", this, _LOG_ERROR, _tBfrErrMSG234 );\ }#else
#define LOG_ERROR( X ) m_pLog->Log( "KRNL", this, _LOG_ERROR, X );
#endif
IM_Kernel *IM_Kernel::_instance = NULL;
IM_Kernel *IM_Kernel::getInstance(){ if( _instance == NULL ) { _instance = new IM_Kernel; }; return _instance;};
// Constructor implementation
inline IM_Kernel::IM_Kernel( config_setting_t *Settings ) : basicEngine(), basicThread(){ m_pLog = basicLogCollection::getInstance(); m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, "KERNEL" ); m_pWorker = NULL;};
// Destructor implementation
inline IM_Kernel::~IM_Kernel(){ waitThreadEnd( true );};
bool IM_Kernel::start(){ m_pWorker = new IM_DnnWorker( m_pSettings ); if( m_pWorker ) { if( m_pWorker->create() ){ return init(); } else LOG_ERROR( "DNN Worker Create Failure!" ); }; return false;};
bool IM_Kernel::stop( bool Force ){ delete( m_pWorker ); m_pWorker = NULL; waitThreadEnd( Force ); return true;};
networkClientHandler *IM_Kernel::attachNewClient( int SocketID ){ IM_ClientHandler *tVal; tVal = new IM_ClientHandler( SocketID ); if( tVal ) { tVal->attachEngine( this ); }; return (networkClientHandler *) tVal;};
bool IM_Kernel::detachClient( networkClientHandler *ptr ){ delete( (IM_ClientHandler *) ptr ); return true;};
void IM_Kernel::m_fThreadProc( void ){ m_bThreadStatus = TH_WORKING; while( m_bThreadStatus < TH_ENDED ) { SLEEP( DEFAULT_THREAD_SLEEP_TIME ); };};
#undef LOG
#undef LOG_ERROR
|