Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Change exception_ptr name in waitall
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudh2290 committed Mar 21, 2019
1 parent 54e301f commit 9e6972a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/engine/threaded_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,21 +415,21 @@ void ThreadedEngine::WaitForAll() {
finished_cv_.wait(lock, [this]() {
return pending_.load() == 0 || kill_.load();
});
std::exception_ptr tmp;
std::exception_ptr exception_to_rethrow;
if (!global_exception_refs_.empty()) {
// iterate through all exception refs
for (const auto& global_exception_ref : global_exception_refs_) {
// the first exception will be saved to be rethrown later
if (*global_exception_ref != nullptr && tmp == false) {
tmp = *global_exception_ref;
if (*global_exception_ref != nullptr && exception_to_rethrow == false) {
exception_to_rethrow = *global_exception_ref;
}
// clear exceptions, WaitToRead following WaitForAll shouldn't throw
*global_exception_ref = nullptr;
}
// A waitall following a waitall shouldn't throw any exceptions
global_exception_refs_.clear();
if (tmp != nullptr) {
std::rethrow_exception(tmp);
if (exception_to_rethrow != nullptr) {
std::rethrow_exception(exception_to_rethrow);
}
}
}
Expand Down

0 comments on commit 9e6972a

Please sign in to comment.