Skip to content
Snippets Groups Projects
Commit 9a925837 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[threadstorage] give a nicer exception

parent 286f680e
No related branches found
No related tags found
No related merge requests found
......@@ -20,8 +20,11 @@
#include <list>
#include <mutex>
#include <numeric>
#include <system_error>
#include <type_traits>
#include <dune/xt/common/exceptions.hh>
// TODO: the following includes can be removed when UnsafePerThreadValue is removed
#include <deque>
#include <memory>
......@@ -389,10 +392,14 @@ public:
void finalize_imp()
{
std::lock_guard<std::mutex> lock_base(base_->mutex_);
Reduction reduce;
base_->set_result(reduce(base_->result(), imp_->result()));
}
try {
std::lock_guard<std::mutex> lock_base(base_->mutex_);
Reduction reduce;
base_->set_result(reduce(base_->result(), imp_->result()));
} catch (std::system_error& ee) {
DUNE_THROW(Exceptions::external_error, "Could not acquire lock! The original system_error was: " << ee.what());
}
} // ... finalize_imp(...)
protected:
Imp* imp_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment