Example #1
0
    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;
    }