caiconghui commented on a change in pull request #5111: URL: https://github.com/apache/incubator-doris/pull/5111#discussion_r548850976
########## File path: be/src/exec/olap_scan_node.cpp ########## @@ -1250,12 +1250,25 @@ void OlapScanNode::transfer_thread(RuntimeState* state) { state->resource_pool()->release_thread_token(true); VLOG(1) << "TransferThread finish."; - std::unique_lock<std::mutex> l(_row_batches_lock); - _transfer_done = true; + { + std::unique_lock<std::mutex> l(_row_batches_lock); + _transfer_done = true; + } _row_batch_added_cv.notify_all(); + + std::unique_lock<std::mutex> l(_scan_batches_lock); + while (_running_thread != 0) { Review comment: Is it better to use C++11 promise and future to instead of checking _running_thread == 0? every scanner_thread just need to set its promise value when finish task with lock free, and close OlapScanNode close just need to wait all scanner_thread return future result ? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org