Back to index

im-sdk  12.3.91
main.cpp
Go to the documentation of this file.
00001 #include <config.h>
00002 #include "IMBasicObject.hh"
00003 #include "IMSignal.hh"
00004 #include "IMSvr.hh"
00005 #include "IMSvrArg.hh"
00006 #include "IMLog.hh"
00007 #include "IMUtil.hh"
00008 #include "IMScheduler_MTPC.hh"
00009 
00010 #ifdef HAVE_TLS
00011 #include "IMTLS.hh"
00012 #endif
00013 
00014 int main(
00015     int argc,
00016     char **argv
00017 )
00018 {
00019     int exitcode;
00020 
00021     IMSvrArg arg(argc, argv);
00022     IMSvr svr(&arg);
00023 
00024     // Initialize singleton classes.
00025 
00026     //signal handling
00027     IMSignal *pimsignal = IMSignal::construct(&svr);
00028     if (!pimsignal) return IMSvr::IMSVR_SYSTEM_ERROR;
00029     //logging system
00030     IMLog *pimlog = IMLog::construct(argv[0]);
00031     if (!pimlog) return IMSvr::IMSVR_SYSTEM_ERROR;
00032     //scheduler
00033     IMScheduler *pimsch = IMScheduler_MTPC::construct();
00034     if (!pimsch) return IMSvr::IMSVR_SYSTEM_ERROR;
00035     //object manager
00036     IMObjectMgr *pimobjmgr = IMObjectMgr::construct();
00037     if (!pimobjmgr) return IMSvr::IMSVR_SYSTEM_ERROR;
00038 #ifdef HAVE_TLS
00039     // tls manager
00040     IMTLS *ptls = IMTLS::construct();
00041     if (!ptls) return IMSvr::IMSVR_SYSTEM_ERROR;
00042 #endif
00043 
00044     exitcode = svr.start();
00045 
00046     // cleanup
00047     IMSignal::cleanup();
00048     IMLog::cleanup();
00049     IMDaemon::cleanup();
00050 #ifdef HAVE_TLS
00051     IMTLS::cleanup();
00052 #endif
00053 
00054     return exitcode;
00055 }
00056 
00057 
00058 /* Local Variables: */
00059 /* c-file-style: "iiim-project" */
00060 /* End: */