[coll] Prevent race during error check. (#10319)

This commit is contained in:
Jiaming Yuan 2024-05-29 06:43:16 +08:00 committed by GitHub
parent 7354955cbb
commit 2de67f0050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -185,7 +185,8 @@ void Loop::Process() {
if (!rc.OK()) {
set_rc(std::move(rc));
} else {
CHECK(qcopy.empty());
std::unique_lock lock{mu_};
CHECK(qcopy.empty() || stop_);
}
} catch (std::exception const& e) {
curr_exce_ = std::current_exception();