File tree Expand file tree Collapse file tree 3 files changed +11
-13
lines changed
Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ typedef unsigned char uint8;
2222
2323// the limit of the queue to store the packs
2424// error may happen if it generates more packs than this number
25- static const int PACK_NUM_LIMIT = 1000000 ;
25+ static const int PACK_NUM_LIMIT = 5000000 ;
2626
2727// how many reads one pack has
2828static const int PACK_SIZE = 1000 ;
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ void PairEndScanner::consumePack(){
237237 ReadPairPack* data;
238238 std::unique_lock<std::mutex> lock (mRepo .mtx );
239239 // read buffer is empty, just wait here.
240- while (mRepo .writePos == mRepo .readPos ) {
240+ while (mRepo .writePos % PACK_NUM_LIMIT == mRepo .readPos % PACK_NUM_LIMIT ) {
241241 if (mProduceFinished ){
242242 lock.unlock ();
243243 return ;
@@ -246,16 +246,15 @@ void PairEndScanner::consumePack(){
246246 }
247247
248248 data = mRepo .packBuffer [mRepo .readPos ];
249- (mRepo .readPos )++;
250- lock.unlock ();
251-
252- scanPairEnd (data);
253-
249+ mRepo .readPos ++;
254250
255251 if (mRepo .readPos >= PACK_NUM_LIMIT)
256252 mRepo .readPos = 0 ;
257253
254+ lock.unlock ();
258255 mRepo .repoNotFull .notify_all ();
256+
257+ scanPairEnd (data);
259258}
260259
261260void PairEndScanner::producerTask ()
Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ void SingleEndScanner::consumePack(){
206206 ReadPack* data;
207207 std::unique_lock<std::mutex> lock (mRepo .mtx );
208208 // read buffer is empty, just wait here.
209- while (mRepo .writePos == mRepo .readPos ) {
209+ while (mRepo .writePos % PACK_NUM_LIMIT == mRepo .readPos % PACK_NUM_LIMIT ) {
210210 if (mProduceFinished ){
211211 lock.unlock ();
212212 return ;
@@ -215,16 +215,15 @@ void SingleEndScanner::consumePack(){
215215 }
216216
217217 data = mRepo .packBuffer [mRepo .readPos ];
218- (mRepo .readPos )++;
219- lock.unlock ();
220-
221- scanSingleEnd (data);
222-
218+ mRepo .readPos ++;
223219
224220 if (mRepo .readPos >= PACK_NUM_LIMIT)
225221 mRepo .readPos = 0 ;
226222
223+ lock.unlock ();
227224 mRepo .repoNotFull .notify_all ();
225+
226+ scanSingleEnd (data);
228227}
229228
230229void SingleEndScanner::producerTask ()
You can’t perform that action at this time.
0 commit comments