void ObjectFactoryService::cycleCleanup(
        int timeoutMs)
    {
        RCF::ThreadInfoPtr tiPtr = getTlsThreadInfoPtr();
        RCF::ThreadPool & threadPool = tiPtr->getThreadPool();

        if (timeoutMs == 0)
        {
            cleanupStubMap(mClientStubTimeoutS);
        }
        else
        {
            Lock lock(mCleanupThresholdMutex);
            if (!threadPool.shouldStop())
            {
                if (mCleanupIntervalS)
                {
                    unsigned int cleanupIntervalMs = 1000*mCleanupIntervalS;
                    mCleanupThresholdCondition.timed_wait(lock, cleanupIntervalMs);
                }
                else
                {
                    mCleanupThresholdCondition.wait(lock);
                }
                
                if (!threadPool.shouldStop())
                {
                    cleanupStubMap(mClientStubTimeoutS);
                }
            }
        }
    }
Ejemplo n.º 2
0
 bool ObjectFactoryService::cycleCleanup(
     int timeoutMs,
     const volatile bool &stopFlag)
 {
     if (timeoutMs == 0)
     {
         cleanupStubMap(mClientStubTimeoutS);
     }
     else
     {
         Lock lock(mCleanupThresholdMutex);
         if (!stopFlag && !mStopFlag)
         {
             unsigned int cleanupIntervalMs = 1000*mCleanupIntervalS;
             mCleanupThresholdCondition.timed_wait(lock, cleanupIntervalMs);
             if (!stopFlag && !mStopFlag)
             {
                 cleanupStubMap(mClientStubTimeoutS);
             }
             else
             {
                 return true;
             }
         }
     }
     return stopFlag || mStopFlag;
 }