| 432 | } |
| 433 | |
| 434 | void SingleEndProcessor::processorTask(ThreadConfig* config) |
| 435 | { |
| 436 | SingleProducerSingleConsumerList<ReadPack*>* input = config->getLeftInput(); |
| 437 | while(true) { |
| 438 | if(config->canBeStopped()){ |
| 439 | break; |
| 440 | } |
| 441 | while(input->canBeConsumed()) { |
| 442 | ReadPack* data = input->consume(); |
| 443 | processSingleEnd(data, config); |
| 444 | } |
| 445 | if(input->isProducerFinished()) { |
| 446 | if(!input->canBeConsumed()) { |
| 447 | if(mOptions->verbose) { |
| 448 | string msg = "thread " + to_string(config->getThreadId() + 1) + " data processing completed"; |
| 449 | loginfo(msg); |
| 450 | } |
| 451 | break; |
| 452 | } |
| 453 | } else { |
| 454 | std::unique_lock<std::mutex> lk(mBackpressureMtx); |
| 455 | mBackpressureCV.wait_for(lk, std::chrono::milliseconds(1)); |
| 456 | } |
| 457 | } |
| 458 | input->setConsumerFinished(); |
| 459 | |
| 460 | if(mFinishedThreads.fetch_add(1, std::memory_order_release) + 1 == mOptions->thread) { |
| 461 | if(mLeftWriter) |
| 462 | mLeftWriter->setInputCompleted(); |
| 463 | if(mFailedWriter) |
| 464 | mFailedWriter->setInputCompleted(); |
| 465 | } |
| 466 | |
| 467 | if(mOptions->verbose) { |
| 468 | string msg = "thread " + to_string(config->getThreadId() + 1) + " finished"; |
| 469 | loginfo(msg); |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | void SingleEndProcessor::writerTask(WriterThread* config) |
| 474 | { |
nothing calls this directly
no test coverage detected