Beispiel #1
0
void cCrawlManager::Action()
{
    unsigned int i;
    while (Running())
    {
        if (dirQueue.Empty()) 
        {
            // if all crawlers are inactive when Q is empty
            // then nothing more to crawl.
            if (CountActive() == 0)
            {
                isyslog("crawl complete");
                return;
            }
            
            // Q is empty and some crawlers are active, wait for them
            // to fill up the Q and check again.
            cCondWait::SleepMs(10);
            continue;
        } // if dirQueue.Empty()
        
        
        // fill all threads
        for (i = 0; !dirQueue.Empty() && i<num_threads; ++i)
        {
            if (crawlers[i]->Active()) continue;

            crawlers[i]->SetDirectory(dirQueue.Pop());
            crawlers[i]->Start();
            
            crawledDirsCount++;
        } // for
        cCondWait::SleepMs(10);
        
    } // while
} // Action()
Beispiel #2
0
int CTracker::ActiveCount (int bQueryTrackers)
{
if (bQueryTrackers)
	return Query ();
return CountActive ();
}