imgtools/romtools/rofsbuild/r_rofs.cpp
changeset 698 e3ee96a3961c
parent 694 c3fbb20e86f0
equal deleted inserted replaced
697:818fe0ed324b 698:e3ee96a3961c
   264 	Print(ELog, "Vendor ID:               %08x\n", aHdr->iS.iVendorId);
   264 	Print(ELog, "Vendor ID:               %08x\n", aHdr->iS.iVendorId);
   265 	Print(ELog, "Priority:                %d\n\n", aHdr->iProcessPriority);
   265 	Print(ELog, "Priority:                %d\n\n", aHdr->iProcessPriority);
   266 }
   266 }
   267 class Worker : public boost::thread {
   267 class Worker : public boost::thread {
   268     public:
   268     public:
       
   269     static boost::mutex iMutexOut;
   269     static void thrd_func(E32Rofs* rofs){
   270     static void thrd_func(E32Rofs* rofs){
   270         CBytePair bpe;
   271         CBytePair bpe;
   271 
   272 
   272         bool deferred = false;
   273         bool deferred = false;
   273         TPlacingSection* p = rofs->GetFileNode(deferred);
   274         TPlacingSection* p = rofs->GetFileNode(deferred);
   280 		    char* fullsystemname= p->node->iEntry->GetSystemFullName();
   281 		    char* fullsystemname= p->node->iEntry->GetSystemFullName();
   281 		    TPlacedEntry tmpEntry(p->node->iEntry->iFileName, fullsystemname, (p->node->iEntry->iCompressEnabled|| p->node->iEntry->iExecutable));
   282 		    TPlacedEntry tmpEntry(p->node->iEntry->iFileName, fullsystemname, (p->node->iEntry->iCompressEnabled|| p->node->iEntry->iExecutable));
   282 		    rofs->iSymGen->AddEntry(tmpEntry);
   283 		    rofs->iSymGen->AddEntry(tmpEntry);
   283 		    delete[] fullsystemname; 
   284 		    delete[] fullsystemname; 
   284 		}
   285 		}
       
   286 		iMutexOut.lock();
       
   287 		p->node->FlushLogMessages();
       
   288 		iMutexOut.unlock();
   285             }
   289             }
   286             p = rofs->GetFileNode(deferred);
   290             p = rofs->GetFileNode(deferred);
   287         }
   291         }
   288         rofs->ArriveDeferPoint();
   292         rofs->ArriveDeferPoint();
   289         p = rofs->GetDeferredJob();
   293         p = rofs->GetDeferredJob();
   293         }
   297         }
   294     }
   298     }
   295     Worker(E32Rofs* rofs) : boost::thread(thrd_func,rofs) {
   299     Worker(E32Rofs* rofs) : boost::thread(thrd_func,rofs) {
   296     }
   300     }
   297 };
   301 };
       
   302 
       
   303 boost::mutex Worker::iMutexOut;
   298 
   304 
   299 TPlacingSection* E32Rofs::GetFileNode(bool &aDeferred) {
   305 TPlacingSection* E32Rofs::GetFileNode(bool &aDeferred) {
   300 	//get a node from the node list, the node list is protected by mutex iMuxTree.
   306 	//get a node from the node list, the node list is protected by mutex iMuxTree.
   301 	//The iMuxTree also helps to make sure the order in iVPS is consistent with the node list.
   307 	//The iMuxTree also helps to make sure the order in iVPS is consistent with the node list.
   302 	//And this is the guarantee of same outputs regardless of how many threads being used.
   308 	//And this is the guarantee of same outputs regardless of how many threads being used.