bool init(RcfConfigT *) { Lock lock(getRootMutex()); if (gInitRefCount == 0) { gpGlobals = new Globals(); // General initialization. RCF::getCurrentTimeMs(); initAmiHandlerCache(); initLogManager(); initAmi(); initObjectPool(); initPerformanceData(); initThreadLocalData(); initTpHandlerCache(); #if RCF_FEATURE_FILETRANSFER==1 initFileIoThreadPool(); #endif #if RCF_FEATURE_SF==1 initRegistrySingleton(); #endif #ifdef BOOST_WINDOWS initWinsock(); initPfnGetUserName(); #endif #ifndef BOOST_WINDOWS // Disable broken pipe signals on non-Windows platforms. std::signal(SIGPIPE, SIG_IGN); #endif #if RCF_FEATURE_SSPI==1 SspiInitialize(); #endif #if RCF_FEATURE_SERVER==1 // Start the AMI thread pool. gpAmiThreadPool = new AmiThreadPool(); gpAmiThreadPool->start(); #endif } ++gInitRefCount; return gInitRefCount == 1; }
bool deinit() { Lock lock(getRootMutex()); --gInitRefCount; if (gInitRefCount == 0) { #if RCF_FEATURE_SERVER==1 // Stop the AMI thread pool. gpAmiThreadPool->stop(); delete gpAmiThreadPool; gpAmiThreadPool = NULL; #endif #if RCF_FEATURE_FILETRANSFER==1 deinitFileIoThreadPool(); #endif #ifdef BOOST_WINDOWS deinitPfnGetUserName(); deinitWinsock(); #endif #if RCF_FEATURE_SSPI==1 SspiUninitialize(); #endif #if RCF_FEATURE_SF==1 deinitRegistrySingleton(); #endif // General deinitialization. deinitAmi(); deinitObjectPool(); deinitAmiHandlerCache(); deinitPerformanceData(); deinitThreadLocalData(); deinitTpHandlerCache(); deinitLogManager(); delete gpGlobals; gpGlobals = NULL; } return gInitRefCount == 0; }
bool deinit() { Lock lock(getRootMutex()); --gInitRefCount; if (gInitRefCount == 0) { // Stop the AMI thread pool. gpAmiThreadPool->stop(); delete gpAmiThreadPool; gpAmiThreadPool = NULL; // General deinitialization. deinitAmiHandlerCache(); delete IdentityFilter::spFilterDescription; IdentityFilter::spFilterDescription = NULL; delete XorFilter::spFilterDescription; XorFilter::spFilterDescription = NULL; deinitFileIoThreadPool(); deinitAmi(); deinitObjectPool(); #ifdef RCF_USE_OPENSSL deinitOpenSslEncryptionFilterDescription(); #endif deinitPerformanceData(); deinitThreadLocalData(); deinitTpHandlerCache(); #ifdef RCF_USE_ZLIB deinitZlibCompressionFilterDescriptions(); #endif #ifdef BOOST_WINDOWS SspiUninitialize(); deinitPfnGetUserName(); deinitWinsock(); #endif #ifdef RCF_USE_SF_SERIALIZATION deinitRegistrySingleton(); #endif deinitLogManager(); delete gpGlobals; gpGlobals = NULL; } return gInitRefCount == 0; }
bool init(RcfConfigT *) { Lock lock(getRootMutex()); if (gInitRefCount == 0) { gpGlobals = new Globals(); // General initialization. RCF::getCurrentTimeMs(); initAmiHandlerCache(); IdentityFilter::spFilterDescription = new FilterDescription("identity filter", RcfFilter_Identity, true); XorFilter::spFilterDescription = new FilterDescription("Xor filter", RcfFilter_Xor, true); initFileIoThreadPool(); initAmi(); #if defined(BOOST_WINDOWS) initNamedPipeEndpointSerialization(); #endif initObjectPool(); initPerformanceData(); //#if defined(sun) || defined(__sun) || defined(__sun__) //if (!pThreadLocalDataPtr) pThreadLocalDataPtr = new ThreadLocalDataPtr; //#endif initThreadLocalData(); initTpHandlerCache(); #ifdef RCF_USE_OPENSSL //initOpenSsl(); initOpenSslEncryptionFilterDescription(); #endif #ifdef RCF_USE_ZLIB initZlibCompressionFilterDescriptions(); #endif initLogManager(); #ifdef RCF_USE_SF_SERIALIZATION initRegistrySingleton(); initTcpEndpointSerialization(); initUdpEndpointSerialization(); #if defined(BOOST_WINDOWS) initWin32NamedPipeEndpointSerialization(); #endif #ifdef RCF_HAS_LOCAL_SOCKETS initUnixLocalEndpointSerialization(); #endif #endif // RCF_USE_SF_SERIALIZATION #ifdef BOOST_WINDOWS initWinsock(); initPfnGetUserName(); SspiInitialize(); #endif #ifndef BOOST_WINDOWS // Disable broken pipe signals. std::signal(SIGPIPE, SIG_IGN); #endif // Start the AMI thread pool. gpAmiThreadPool = new AmiThreadPool(); gpAmiThreadPool->start(); } ++gInitRefCount; return gInitRefCount == 1; }