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