From 16c4b8f0a81ed66f1c9334de1facac9acd88aba4 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 31 May 2021 13:35:55 +0200 Subject: [PATCH] RemotePointEvaluation: fix race condition if called multiple times --- include/deal.II/base/mpi_remote_point_evaluation.h | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.39.5