yiguolei commented on code in PR #12620: URL: https://github.com/apache/doris/pull/12620#discussion_r1013691162
########## be/src/util/blocking_queue.hpp: ########## @@ -47,25 +48,19 @@ class BlockingQueue { // are no more elements available. bool blocking_get(T* out) { MonotonicStopWatch timer; + timer.start(); std::unique_lock<std::mutex> unique_lock(_lock); - - while (true) { - if (!_list.empty()) { - *out = _list.front(); - _list.pop_front(); - _total_get_wait_time += timer.elapsed_time(); - unique_lock.unlock(); - _put_cv.notify_one(); - return true; - } - - if (_shutdown) { - return false; - } - - timer.start(); - _get_cv.wait(unique_lock); - timer.stop(); + _get_cv.wait(unique_lock, [this] { return _shutdown || !_list.empty(); }); + _total_get_wait_time += timer.elapsed_time(); + Review Comment: timer.stop lost? or it is useless? -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org 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