| 86 | } |
| 87 | |
| 88 | void ThreadConfig::markProcessed(long readNum) { |
| 89 | mCurrentSplitReads += readNum; |
| 90 | if(!mOptions->split.enabled) |
| 91 | return ; |
| 92 | // if splitting is enabled, check whether current file is full |
| 93 | if(mCurrentSplitReads >= mOptions->split.size) { |
| 94 | // if it's splitting by file number, totally we cannot exceed split.number |
| 95 | // if it's splitting by file lines, then we don't need to check |
| 96 | if(mOptions->split.byFileLines || mWorkingSplit + mOptions->thread < mOptions->split.number ){ |
| 97 | mWorkingSplit += mOptions->thread; |
| 98 | initWriterForSplit(); |
| 99 | mCurrentSplitReads = 0; |
| 100 | } else { |
| 101 | // this thread can be stoped now since all its tasks are done |
| 102 | // only a part of threads have to deal with the remaining reads |
| 103 | if(mOptions->split.number % mOptions->thread >0 |
| 104 | && mThreadId >= mOptions->split.number % mOptions->thread) |
| 105 | mCanBeStopped = true; |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // if a task of writting N files is assigned to this thread, but the input file doesn't have so many reads to input |
| 111 | // write some empty files so it will not break following pipelines |