[container] fix deadlock
The problem was a locked method calling backend(), thus calling ensure_uniqueness(), which in turn waited for a lock. The solution is to first ensure uniqueness and obtain, then lock, then use a reference on the unique backend. This is in general acchieved by ``` auto& backend_ref = backend(); // calles ensure_uniqueness() std::lock... // work with backend_ref ``` To make it a bit more explicit what is going on we could also let ensure_uniqueness() return a `BackendType&` and use that instead of backend().
Showing
- dune/xt/la/container/common.hh 30 additions, 22 deletionsdune/xt/la/container/common.hh
- dune/xt/la/container/eigen/base.hh 13 additions, 7 deletionsdune/xt/la/container/eigen/base.hh
- dune/xt/la/container/eigen/dense.hh 26 additions, 23 deletionsdune/xt/la/container/eigen/dense.hh
- dune/xt/la/container/eigen/sparse.hh 36 additions, 30 deletionsdune/xt/la/container/eigen/sparse.hh
- dune/xt/la/container/istl.hh 25 additions, 13 deletionsdune/xt/la/container/istl.hh
Loading
Please register or sign in to comment