- better CRC worker thread distribution

This commit is contained in:
Mark Vejvoda 2011-03-26 05:16:39 +00:00
parent 3c73464f5a
commit 846dd4769b
1 changed files with 14 additions and 1 deletions

View File

@ -96,6 +96,20 @@ void FileCRCPreCacheThread::execute() {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] workerIdx = %d, currentWorkerMax = %d, endConsumerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,workerIdx,currentWorkerMax,endConsumerIndex);
// Pause before launching this worker thread
//sleep(100);
const double PAUSE_SECONDS_BETWEEN_WORKERS = 10;
time_t pauseTime = time(NULL);
while(getQuitStatus() == false &&
difftime(time(NULL),pauseTime) <= PAUSE_SECONDS_BETWEEN_WORKERS) {
sleep(25);
}
if(getQuitStatus() == true) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
break;
}
FileCRCPreCacheThread *workerThread =
new FileCRCPreCacheThread(techDataPaths,
workerTechList,
@ -103,7 +117,6 @@ void FileCRCPreCacheThread::execute() {
workerThread->setUniqueID(__FILE__);
preCacheWorkerThreadList.push_back(workerThread);
workerThread->start();
sleep(100);
consumedWorkers += currentWorkerMax;
if(consumedWorkers >= techPaths.size()) {