Skip to content

Commit

Permalink
Merge pull request dealii#16174 from bangerth/x4
Browse files Browse the repository at this point in the history
Split a mutex into two, give them better names.
  • Loading branch information
kronbichler authored Oct 24, 2023
2 parents add4978 + 2d6f3dc commit ee37874
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions include/deal.II/fe/fe_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,11 @@ class FESystem : public FiniteElement<dim, spacedim>
};

/**
* Mutex for protecting initialization of restriction and embedding matrix.
* Mutex variables used for protecting the initialization of restriction
* and embedding matrices.
*/
mutable std::mutex mutex;
mutable std::mutex restriction_matrix_mutex;
mutable std::mutex prolongation_matrix_mutex;

friend class FE_Enriched<dim, spacedim>;
};
Expand Down
4 changes: 2 additions & 2 deletions source/fe/fe_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ FESystem<dim, spacedim>::get_restriction_matrix(
// initialization upon first request
if (this->restriction[refinement_case - 1][child].n() == 0)
{
std::lock_guard<std::mutex> lock(this->mutex);
std::lock_guard<std::mutex> lock(restriction_matrix_mutex);

// check if updated while waiting for lock
if (this->restriction[refinement_case - 1][child].n() ==
Expand Down Expand Up @@ -990,7 +990,7 @@ FESystem<dim, spacedim>::get_prolongation_matrix(
// restriction matrix
if (this->prolongation[refinement_case - 1][child].n() == 0)
{
std::lock_guard<std::mutex> lock(this->mutex);
std::lock_guard<std::mutex> lock(prolongation_matrix_mutex);

if (this->prolongation[refinement_case - 1][child].n() ==
this->n_dofs_per_cell())
Expand Down

0 comments on commit ee37874

Please sign in to comment.