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 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;
    }