X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=seqsummarycommand.cpp;h=37d0fdfe10fdbe3eb11d3c7f74cbc84389acead9;hb=5d00ef3e809832f08efdd691a9eace8ac20feb07;hp=e8f73ca10875f8321f624adfb62ee02f7baf2770;hpb=755185afe1c287b8c6eddf9eedd293a38fc9f998;p=mothur.git diff --git a/seqsummarycommand.cpp b/seqsummarycommand.cpp index e8f73ca..37d0fdf 100644 --- a/seqsummarycommand.cpp +++ b/seqsummarycommand.cpp @@ -603,25 +603,29 @@ int SeqSummaryCommand::createProcessesCreateSummary(vector& startPosition, ////////////////////////////////////////////////////////////////////////////////////////////////////// vector pDataArray; - DWORD dwThreadIdArray[processors]; - HANDLE hThreadArray[processors]; + DWORD dwThreadIdArray[processors-1]; + HANDLE hThreadArray[processors-1]; //Create processor worker threads. - for( int i=0; istart << '\t' << lines[i]->end << endl; + for( int i=0; istart, lines[i]->end, namefile, nameMap); + seqSumData* tempSum = new seqSumData(&startPosition, &endPosition, &seqLength, &ambigBases, &longHomoPolymer, filename, (sumFile+extension), m, lines[i]->start, lines[i]->end, namefile, nameMap); pDataArray.push_back(tempSum); - processIDS.push_back(i); - + //MySeqSumThreadFunction is in header. It must be global or static to work with the threads. //default security attributes, thread function name, argument to thread function, use default creation flags, returns the thread identifier hThreadArray[i] = CreateThread(NULL, 0, MySeqSumThreadFunction, pDataArray[i], 0, &dwThreadIdArray[i]); } - + + //do your part + num = driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, fastafile, (sumFile+toString(processors-1)+".temp"), lines[processors-1]); + processIDS.push_back(processors-1); + //Wait until all threads have terminated. - WaitForMultipleObjects(processors, hThreadArray, TRUE, INFINITE); + WaitForMultipleObjects(processors-1, hThreadArray, TRUE, INFINITE); //Close all thread handles and free memory allocations. for(int i=0; i < pDataArray.size(); i++){ @@ -629,8 +633,7 @@ int SeqSummaryCommand::createProcessesCreateSummary(vector& startPosition, CloseHandle(hThreadArray[i]); delete pDataArray[i]; } - - //rename((sumFile + toString(processIDS[0]) + ".temp").c_str(), sumFile.c_str()); + //append files for(int i=0;iappendFiles((sumFile + toString(processIDS[i]) + ".temp"), sumFile);