From: Peter Munch Date: Mon, 31 May 2021 11:35:55 +0000 (+0200) Subject: RemotePointEvaluation: fix race condition if called multiple times X-Git-Tag: v9.3.0~4^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16c4b8f0a81ed66f1c9334de1facac9acd88aba4;p=dealii.git RemotePointEvaluation: fix race condition if called multiple times --- diff --git a/include/deal.II/base/mpi_remote_point_evaluation.h b/include/deal.II/base/mpi_remote_point_evaluation.h index ebd3f3a5b8..182b779d5a 100644 --- a/include/deal.II/base/mpi_remote_point_evaluation.h +++ b/include/deal.II/base/mpi_remote_point_evaluation.h @@ -266,6 +266,9 @@ namespace Utilities (void)buffer; (void)evaluation_function; #else + static CollectiveMutex mutex; + CollectiveMutex::ScopedLock lock(mutex, tria->get_communicator()); + output.resize(point_ptrs.back()); buffer.resize(send_permutation.size() * 2); ArrayView buffer_1(buffer.data(), buffer.size() / 2); @@ -377,6 +380,9 @@ namespace Utilities (void)buffer; (void)evaluation_function; #else + static CollectiveMutex mutex; + CollectiveMutex::ScopedLock lock(mutex, tria->get_communicator()); + const auto &ptr = this->get_point_ptrs(); std::map> temp_recv_map;